All the light from all the stars that have ever existed. It is a quantity of unimaginable magnitude, but now astronomers have put a number on it.

From the earliest, faintest stars, to the largest galaxies, an international team has managed to measure the total amount of starlight emitted over the entire 13.7bn-year history of the universe.

“This has never been done before,” said Marco Ajello, an astrophysicist at the Clemson College of Science in South Carolina and the paper’s lead author.

The first stars flickered into being a few hundred million years after the big bang. Since then, galaxies have churned out stars at a stupendous rate, and scientists estimate there were now about a trillion trillion.

In total, the astronomers estimate, stars have radiated 4x1084 photons (a photon being the smallest unit of light). Or put another way: 4,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 photons.

The astronomers based their calculation on measurements of the extragalactic background light (EBL), a cosmic fog of radiation that has been accumulating since stars first illuminated the dark, vast expanse of space.

More than 90% of starlight ends up surviving in this dim backdrop of radiation.

“Today we are sitting in this sea of light,” said Kári Helgason, of the University of Iceland, Reykjavík and a co-author of the paper.

Since it was masked by the light from nearby stars, though, the EBL has proved tricky to investigate.

The latest observations, collected over nine years by Nasa’s Fermi space telescope, use the light from blazars – super-massive black holes that emit powerful jets of gamma rays – as beacons to illuminate the cosmic fog. “They are so bright they can shine across almost the whole observable universe,” said Helgason.

In total, the team captured signals from 739 blazars – some relatively close and some extremely distant, whose light was emitted in the ancient universe and has taken billions of years to arrive at Earth.

Gamma-ray photons travelling through a fog of starlight have a high chance of being absorbed. So by taking blazars at different distances from the Earth and working out how much of their radiation had been lost along the way, the total starlight at different time periods could be ascertained.

“We measured the total starlight of each epoch – 1bn years ago, 2bn years ago, 6bn years ago, all the way back to when stars were first formed,” said Vaidehi Paliya, a co-author of the paper, also of Clemson.

“It’s really this distribution that give us the opportunity to reconstruct the background light as a function of time,” said Helgason.

One added complication was that, while starlight is accumulating over time, the cosmic fog is simultaneously being diluted as the universe expands and space itself is stretched out. Overall, the fog is still getting denser. This, and other complex phenomena, were factored in using a computer model.

The measurements suggest that star formation peaked about 11bn years ago and has been on the wane ever since. About seven new stars are created in our Milky Way galaxy every year.

The findings, published in the journal Science, closely align with previous indirect estimates of total starlight based on galaxy surveys. “That’s really satisfying when two methods give you the same answer,” said Helgason.

The data also provides new insights into the first billion years of the universe’s history, an epoch that has not yet been probed by current satellites.

“Our measurement allows us to peek inside it,” said Ajello. “Perhaps one day we will find a way to look all the way back to the big bang. This is our ultimate goal.”