We established a stress-history-dependent porosity model of potential target rocks for CO2 geosequestration based on porosity measurements of rock samples under various effective stresses (5 MPa to 120 MPa). Measured samples were collected from shallow boreholes (< 300 m depth) drilled at the frontal fold in northern Taiwan. The lithology, density and the stress-history-dependent porosity derived from shallow boreholes enabled us to predict the porosity-depth relationship of given rock formations at (burial depths of approximately 3,170 m to 3,470 m) potential sites for CO2 geosequestration locating near the coastline of the Taoyuan Tableland. Our results indicate that the porosity of samples derived from laboratory tests under atmospheric pressure is significantly greater than the porosity measured under stress caused by the sediment burial. It is therefore strongly recommended that the assessment of CO2 storage capacity not be estimated from the porosity measured under atmospheric pressure. Meanwhile, neglecting the effect of the stress history on the porosity of compacted and uplifted rocks may induce a percentage error of 7.7 % at a depth of approximately 1,000 m, where the thickness of the eroded, formerly overlying formation is 2.5 km in a synthetic case. The effect of the CO2 injection pressure on the porosity was also evaluated using the stress-history-dependent porosity model. As expected, the pore pressure buildup during the CO2 injection will induce an increase in the rock porosity. For example, a large injection pressure of 13 MPa at a depth of approximately 1,000 m will increase the rock porosity by a percentage error of 6.7 %. Our results have implications for the injection pressure in estimates of CO2 storage capacity.