The past two decades have seen transformative advances in cosmology and string theory. Observations of the cosmic microwave background have revealed strong evidence for inflationary expansion in the very early universe, while new insights about compactifications of string theory have led to a deeper understanding of inflation in a framework that unifies quantum mechanics and general relativity. Written by two of the leading researchers in the field, this complete and accessible volume provides a modern treatment of inflationary cosmology and its connections to string theory and elementary particle theory. After an up-to-date experimental summary, the authors present the foundations of effective field theory, string theory, and string compactifications, setting the stage for a detailed examination of models of inflation in string theory. Three appendices contain background material in geometry and cosmological perturbation theory, making this a self-contained resource for graduate students and researchers in string theory, cosmology, and related fields.