NASA's Swift space telescope has been used to directly measure the distance to fleeting cosmic explosions, called gamma-ray bursts, for the first time. The measurements are crucial for determining how much energy the bursts unleash.

Gamma-ray bursts (GRBs) are powerful blasts of high-energy gamma-ray photons thought to herald the birth of black holes. They typically last less than a minute but can produce afterglows at a range of wavelengths - from X-rays to radio waves - that linger for hours or weeks. The afterglows can reveal the distance and nature of the bursts, and Swift was designed to swivel towards them in about a minute.

Swift has detected two dozen GRBs since its launch in November 2004, and it has found X-ray afterglows for about 15 of them. But until recently, it saw no optical afterglows - light emitted in the visible spectrum - even when ground-based observers looking at the same bursts did. "We were getting a little worried," admits Dale Frail, a Swift team member at the National Radio Astronomy Observatory in Socorro, New Mexico, US.

But Swift's Ultraviolet/Optical Telescope (UVOT) has made up for lost time, catching the optical afterglow of a bright GRB on 18 March 2005 and a second one the very next day. "Now we know there's no problem - the first few events were just too faint for UVOT to detect".