The planet Earth formed about 4.6 billion years (4,567,000,000 years) ago, in a fully molten state, from the protoplanetary debris disc orbiting the newly formed Sun. Another, smaller Mars-sized planet, called Theia, is thought to have formed in the same orbit as the Earth around this time. After 28 - 34 million years (4.527 - 4.533 billion years ago), orbital oscillations caused Theia to impact the Earth, ejecting a large amount of crust and forming the Moon. That is the best current theory of the Moon’s formation, called the Giant impact hypothesis.
The first era in the history of the Earth is known as the Hadean Eon (named after the underworld of Greek mythology, Hades), which extends from the Earth’s formation to 3.8 billion years ago. The oceans began forming during the first part of the Hadean, possibly as long as 4.2 million years ago. The Earth cooled from a molten state, forming a solid crust within just 100 - 150 million years. Heavier elements such as iron and nickel sank to the core of the Earth, leaving smaller quantities on the surface. The entire planet differentiated into layers. During the latter part of the Hadean, about four billion years ago, primitive life emerged, perhaps as small self-replicating strands of DNA or RNA using energy-rich chemicals for fuel (heterotrophs).
The next era of the history of the Earth, known as the Archean Eon, lasted from 3.8 billion to 2.5 billion years ago. Molecular dating studies have indicated that the last universal common ancestor (LUCA) of contemporary life lived during the early part of the Archean, 3.5 billion years ago or earlier. This is around the same time as the first autotrophs evolved. An autotroph is an organism capable of using photosynthesis to extract energy from sunlight. Oxygen is a waste product is photosynthesis, and it was released in large quantities around this time. Since oxygen was poisonous to most organisms living then, there was a mass extinction and a reshaping of atmospheric and surface chemistry, called the “Oxygen Catastrophe.”
The Eons that follow the Hadean and Archean are the Proterozoic (“primitive era of life”), lasting from 2.5 billion to just 542 million years ago, the Paleozoic (“old era of life”) lasting from 542 to 251 million years ago, the Mesozoic (“middle era of life”) lasting from 251 to 65 million years ago, and the Cenozoic (“recent era of life”) lasting from 65 million years ago to the present. In the Proterozoic, except for the last few dozen million years, the only known forms of life were primitive microbes. Only in the last 542 million years, about 12% of the history of the Earth, did complex multicellular life evolve.