A novel method has been developed to quantify clay swelling in aqueous solutions. In this method, a swelling clay is dispersed into an aqueous solution of desired composition, and then mounted in a special cell for X-ray diffraction (XRD) analysis. Using this method, the effects of solution pH, salinity, cation composition, temperature, fluid pressure, and overburden pressure on clay swelling can all be determined efficiently. This method uses only a small amount of sample and offers some advantages over the conventional coreflood method. It can also be used to evaluate the performance of clay stabilizers. We have determined the critical salt concentration (CSC) and critical cation ratio (e.g., Na/Ca, Na/K) for macroscopic osmotic swelling of the most common swelling clays. The information can be represented by a set of swelling diagrams in which the solution composition responsible for osmotic swelling and formation damage is delineated. The swelling diagrams can be used to determine the compatibility between shales and drilling fluids, between swelling clays and drilling filtrate or completion fluids, and between swelling clays and flooding fluids used in EOR. The effects of temperature and pressure on clay swelling have also been quantified using this method. Temperature has a small effect on clay swelling between 20-100°C; but the differential pressure between the overburden and fluid pressures (Po - Pf) has a significant effect on clay swelling. The greater the differential pressure, the less the clay swells. The important implications of these results on petroleum drilling and production will be discussed. It should be cautioned that the swelling diagrams can not be applied to fines migration problems associated with non-swelling clays such as kaolinite and illite.