Sandstone microstructure at scales of 5-5000 mu m is a domainal structure consisting of juxtaposed clusters of efficiently packed grains bounded by packing flaws. The flaws represent zones of loose packing arising from grain-to-grain mismatches between well-packed clusters. Flaws tend to propagate throughout the sediment and are marked in thin section by zones of oversized pores known to be associated with enhanced fluid flow. Using a two-dimensional Fourier transform it is possible to identify these flawed zones and examine not only their spatial distribution but also the relative contribution of close-packed and flawed porosity to the pore network as a whole. Flaws represent zones of disorder formed through a variety of depositional and postdepositional processes. Two flaw-producing mechanisms have been recognized in random aggregates of spheres created in a laboratory. The first arises from grain-to-grain mismatches at the boundaries of concurrently growing grain clusters. The second type is associated with the growth of well-packed clusters over a preexisting cohesive substrate (in the laboratory, this is represented by the walls of the container holding the aggregate). The distribution of loose-packed and well-packed grain domains in natural sands is governed by depositional environment. The size and shape of the constituent grains define the fundamental spatial frequency of porosity, but factors such as grain orientation and size sorting affect the orientation of clusters and flaws as well as the scale at which they exist. For example, flaws in poorly sorted sands arise from the misfit of the finer size classes in a grain matrix controlled by the larger grains. The flaws generated by this misfit propagate throughout the fine-grained sections of the sediment with a spatial period characteristic of the coarser size classes. Grain clusters and flaws can be recognized as major textural elements in all sands and sandstones, even those with macroporosity as low as 5%. Not only is the depositional "signal" preserved as porosity decreases, its existence affords the opportunity to closely examine the effects of diagenesis upon the pore network. As porosity decreases, the relative proportion of flawed porosity increases. By the time total porosity has been reduced to 5%, flawed porosity has increased to the point that it constitutes 80% of the remainder. The increase in relative proportion of loose-packed porosity is due to preferential cementation within well-packed clusters, as well us an increase in loose-packed porosity due to dissolution of unstable mineral grains. In all the diagenetically altered sandstones examined, the only grain molds or partially dissolved grains present were found to be located either within or immediately adjacent to packing flaws.