Axions are a class of particles that play a significant role in explaining unknown aspects of cosmology. They are well-motivated in high energy physics, appearing in theories related to CP-violation in the standard model, supersymmetric theories, and theories with extra dimensions, including string theory. This review discusses the motivation and models for axions in particle physics and string theory, and presents a comprehensive view on the cosmology and astrophysics of axion-like particles, starting from inflation and progressing through BBN, the CMB, reionization, and structure formation, up to the present-day Universe. Topics include axion dark matter, direct and indirect detection of axions, axions as dark radiation, axions and the cosmological constant problem, decays of heavy axions, axions and stellar astrophysics, black hole superradiance, axions and astrophysical magnetic fields, axion inflation, and axion dark matter as an indirect probe of inflation. A major focus is on the population of ultralight axions created via vacuum realignment, and its role as a dark matter candidate with distinctive phenomenology. Cosmological observations place robust constraints on the axion mass and relic density in this scenario. The review also covers aspects of galaxy formation with axion dark matter and ways this can be used to further search for evidence of axions. An absolute lower bound on dark matter particle mass is established, with constraints from linear and nonlinear observables. The review also discusses axions in string theory, their role in inflation and the generation of cosmological initial conditions, and their potential to resolve problems of structure formation inherent in more vanilla models of dark matter. Axions can also assist in baryogenesis thanks to their role in CP-violation. The review concludes with a discussion of axions in string theory, their role in inflation and the generation of cosmological initial conditions, and their potential to resolve problems of structure formation inherent in more vanilla models of dark matter.Axions are a class of particles that play a significant role in explaining unknown aspects of cosmology. They are well-motivated in high energy physics, appearing in theories related to CP-violation in the standard model, supersymmetric theories, and theories with extra dimensions, including string theory. This review discusses the motivation and models for axions in particle physics and string theory, and presents a comprehensive view on the cosmology and astrophysics of axion-like particles, starting from inflation and progressing through BBN, the CMB, reionization, and structure formation, up to the present-day Universe. Topics include axion dark matter, direct and indirect detection of axions, axions as dark radiation, axions and the cosmological constant problem, decays of heavy axions, axions and stellar astrophysics, black hole superradiance, axions and astrophysical magnetic fields, axion inflation, and axion dark matter as an indirect probe of inflation. A major focus is on the population of ultralight axions created via vacuum realignment, and its role as a dark matter candidate with distinctive phenomenology. Cosmological observations place robust constraints on the axion mass and relic density in this scenario. The review also covers aspects of galaxy formation with axion dark matter and ways this can be used to further search for evidence of axions. An absolute lower bound on dark matter particle mass is established, with constraints from linear and nonlinear observables. The review also discusses axions in string theory, their role in inflation and the generation of cosmological initial conditions, and their potential to resolve problems of structure formation inherent in more vanilla models of dark matter. Axions can also assist in baryogenesis thanks to their role in CP-violation. The review concludes with a discussion of axions in string theory, their role in inflation and the generation of cosmological initial conditions, and their potential to resolve problems of structure formation inherent in more vanilla models of dark matter.