Many clayey soils shrink as they dry, causing a shift of porosity from inside to outside the soil aggregates and leading to the formation of shrinkage cracks and/or surface subsidence. During swelling, shrinkage cracks begin to seal and/or the soil surface rises. Previous models have focused on describing shrinkage at the aggregate level, with little success in predicting soil cracking and subsidence. To remedy this shortcoming, we provide a unified, physically based set of governing equations for these three pore domains (aggregates, cracks, and subsidence) and predict the porosity distribution among domains as a function of soil water content and minimal (up to six) additional parameters. Examples collected from a variety of soils show how these functions describe shrinkage of soil samples in the laboratory; quantify the relationships among soil suction, soil shrinkage, and water content using the same set of parameters; and predict sealing of soil cracks in the field. This approach provides the framework for accurate and unified hydromechanical modeling of swelling soils.