A continuum mechanics model for the gravitational compaction of sediments is derived by assuming that the sediments are normally pressured and in a one-dimensional state of stress. Sediment strength is characterized in terms of effective stress laws adopted from soil mechanics. The model is a relatively simple mathematical formula that gives the porosity as a function of burial depth. The shape of the porosity profile is controlled by two mechanical parameters, the compression index and the void ratio at an effective stress of 100 kPa. The model was verified by analysing the porosity—depth data of oozes and chalk from the Ontong Java Plateau, gathered during Leg 130 of the Ocean Drilling Program. The mechanical parameters of the sediments were estimated using a least-squares method to fit the theoretical profile to the porosity data. The theoretical profile described accurately the ooze porosity data over depth ranges of 100 m or more. However, over smaller length-scales of 10–50 m there were systematic deviations between the theoretical porosity values and the ooze porosity data. The porosity deviations correlated with variations in the mean grain size of the sediments, due in part to changes in the foraminifera abundance. In the case of the oozes, the estimated mechanical parameters were consistent with published values obtained from one-dimensional compression tests. In contrast, the estimated mechanical properties for the chalks differed from published values. The chalk porosities were lower than could be explained by mechanical compaction. This explanation is supported by the compressional (P-wave) velocity data. In the chalk sections, the P-wave velocity increases more rapidly with burial depth than it does in the ooze sections, suggesting that sediment elastic properties are increasing due to interparticle binding.