About 4.6 billion years ago, a great swirl of gas and dust some 15 billion miles across accumulated in space where we are now and began to aggregate. Virtually all of it—99.9 percent of the mass of the solar system—went to make the Sun. Out of the floating material that was left over, two microscopic grains floated close enough together to be joined by electrostatic forces.
This was the moment of conception for our planet. All over the inchoate solar system, the same was happening. Colliding dust grains formed larger and larger clumps. Eventually the clumps grew large enough to be called planetesimals. As these endlessly bumped and collided, they fractured or split or recombined in endless random permutations, but in every encounter there was a winner, and some of the winners grew big enough to dominate the orbit around which they traveled.
It all happened remarkably quickly. To grow from a tiny cluster of grains to a baby planet some hundreds of miles across is thought to have taken only a few tens of thousands of years. In just 200 million years, possibly less, the Earth was essentially formed, though still molten and subject to constant bombardment from all the debris that remained floating about.