The earliest the Moon could have formed was about 4.51 billion years ago, shortly after the giant impact that is thought to have formed the Earth-Moon system. The Moon is thought to have formed from the debris ejected by this impact, which came together and coalesced into the Moon over the course of a few million years.