Due to the small pore sizes and organic content of shale, capillary pressure and adsorption are two effects that should be taken into account in the study of phase equilibrium inside shale. The inclusion of both effects in the phase equilibrium modeling can shed light on how bulk phase composition inside the porous media changes with temperature and pressure, and how the phase equilibrium changes accordingly. In the long run, such a model can be used in reservoir simulation for more complicated analysis. In this study, we present a calculation method that can effectively include adsorption and capillarity. We propose to introduce an excess adsorbed phase and treat the remaining substance inside the pores as a bulk phase (gas, liquid, or both) in order to make the mass balance formulation simpler. The adsorbed phase is modeled by the Multicomponent Langmuir (ML) equation for its simplicity and computational efficiency. A more theoretical adsorption model, the multicomponent potential theory of adsorption (MPTA), is used to determine the parameters of the simpler ML equation. The liquid and gas phases are described by the Peng-Robinson equation of state and the capillary pressure across their interface is taken into account. A flash algorithm by alternately updating the adsorbed phase amount and the fugacities in the bulk phases has been developed. The flash algorithm is used to analyze some representative systems (from binary, ternary to low-GOR and high-GOR model reservoir fluid systems) for the phase equilibrium inside porous media. The results show that adsorption and capillary pressure can significantly change the bulk phase composition and thus its corresponding phase envelope. Since the adsorption varies at different temperature and pressure conditions, the extent of change in the phase envelope is different. In general, a much shrunk phase envelope with a shifted critical point is observed. The heavier components are preferentially adsorbed in the whole pressure and temperature range studied here. At high pressure and low temperature, the selectivity towards heavier components is moderate in comparison to the that at low pressure and high temperature. The adsorption effects are stronger for the gas bulk phase region, leading to bigger changes in the gas phase composition and the shift of the dew point curve. PVT simulations of two model reservoir fluid systems show significant change in the results when capillary pressure and adsorption are included.