In the interior of Neptune and Uranus, at incredibly high pressures, carbon and hydrogen are squeezed so hard that the carbon becomes solid diamond. These diamonds are estimated to weigh millions of carats, or hundreds of kilograms.

Now scientists have recreated this process in the lab, albeit on a much smaller scale. The findings are published in a study in Nature Astronomy.

"Previously, researchers could only assume that the diamonds had formed," said study author Dominik Kraus of the Helmholtz Zentrum Dresden-Rossendorf in Germany.

"When I saw the results of this latest experiment, it was one of the best moments of my scientific career."

The scientists used the Linac Coherent Light Source at the SLAC National Accelerator Laboratory to send shock waves at a polystyrene sample. Polystyrene is a good mimic for the elements present near the planets' icy cores, as it is made up of chains of hydrogen and carbon.

Under the shockwaves, nearly every single atom in the sample was turned into nanoscale diamonds. As this was a miniature scale experiment compared with a planet, the diamonds forming inside Neptune and Uranus are thought to be many orders of magnitude larger. Judging by the mass and composition of the planets, they could be forming diamonds of 200kg or more.

It is the first time that researchers have been able to do this while watching them form in real time. Previous research has simulated the formation of diamonds under conditions such as these, but they observations of the process as it happens has been lacking. The X-ray free-electron laser at the accelerator facility allowed the researchers to take snapshots of what was happening in the sample on the scale of just quadrillionths of a second.

"Simulations don't really capture what we're observing in this field," said study coauthor Siegfried Glenzer of the SLAC. "Our study and others provide evidence that matter clumping in these types of high-pressure conditions is a force to be reckoned with."

Uranus could hold million-carat diamonds.NASA/JPL-Caltech