The materials that form the diverse chemicals and structures on Earth-from mountains to oceans and biological organisms-all originated in a universe dominated by hydrogen and helium. Over billions of years, the composition and structure of the galaxies and stars evolved, and the elements of life, CHONPS, were formed through nucleosynthesis in stellar cores. Climactic events such as supernovae and stellar collisions produced heavier elements and spread them throughout the cosmos, often to be incorporated into new, more metal-rich stars. Stars typically form in molecular clouds containing small amounts of dust through the collapse of a high-density core. The surrounding nebular material is then pulled into a protoplanetary disk, from which planets, moons, asteroids, and comets eventually accrete. During the accretion of planetary systems, turbulent mixing can expose matter to a variety of different thermal and radiative environments. Chemical and physical changes in planetary system materials occur before and throughout the process of accretion, though many factors such as distance from the star, impact history, and level of heating experienced combine to ultimately determine the final geophysical characteristics. In Earth's planetary system, called the Solar System, after the orbits of the planets had settled into their current configuration, large impacts became rare, and the composition of and relative positions of objects became largely fixed. Further evolution of the respective chemical and physical environments of the planets-geosphere, hydrosphere, and atmosphere-then became dependent on their local geochemistry, their atmospheric interactions with solar radiation, and smaller asteroid impacts. On Earth, the presence of land, air, and water, along with an abundance of important geophysical and geochemical phenomena, led to a habitable planet where conditions were right for life to thrive.