The early universe was a hot, dense soup of subatomic particles. As the universe expanded and cooled, these particles began to combine to form atoms, including hydrogen and helium. This process, known as recombination, began approximately 380,000 years after the Big Bang when the temperature of the universe decreased enough for electrons to bind to atomic nuclei.
Before that point the photons were constantly scattered by free electrons so the universe was opaque even if it contained sources of photons (such as newly forming stars). Once electrons were confined within neutral atoms photons could propagate freely creating what astronomers called cosmic microwave background radiation that is detected as faint afterglow from every direction .
When the universe first recombination occured the newly produced neutral atoms could be ionized again because of energetic photons produced by early massive stars and quasars . Once enough galaxies formed and emitted ultraviolet (UV) light, the intergalactic medium is thought to have been reionized completely to produce cosmic reionization as early as ~780 million years after the big Bang as estimated from observation .