In the 20 years it’s been in space, the Cassini spacecraft has seen storms on Saturn’s surface, sent a probe down to the planet’s moon Titan, and shown us the eerie beauty of the gas giant’s hexagonal north pole. As it is rapidly running out of fuel, it’s been given one last mission before it goes offline in September: to solve the mystery of the planet’s rings.

“We’re uncertain by quite a large margin about how much stuff is really there [in the rings],” Preston Dyches, a NASA spokesperson for the Cassini mission, said in December. “That has major implication for how they formed and how old they are. That’s still one of the biggest mysteries of Saturn — how did it get these rings — which tells us things about how planets form and how planets form around other stars.”

Studying Saturn’s rings helps scientists understand how planets and solar systems form. It’s likely the Earth and all the planets in our solar system formed out of a ring of gas and debris around the sun.

To solve the mystery, on April 26, Cassini will make a perilous and unprecedented maneuver, diving into the space between the planet and its rings for the first time. Cassini’s “grand finale,” as NASA is calling it, might be its most impressive feat to date.

Cassini will spend its final months getting an unprecedented look at Saturn’s rings

On April 26, after a brief flyby, Cassini will change its orbit and dive into the 1,500-mile-wide space between Saturn and its inner rings. Cassini has never been to this region before. No spacecraft has.

This is what that dive will look like from Cassini’s perspective. It will repeat this 22 times.

When Cassini is in the inner rings, it will finally be able to take the measurements that will aid in calculations to determine the mass of the rings.

As Dyches explains it, NASA already knows the mass of Saturn plus its rings. But it’s difficult to subtract out the mass of the planet’s rings from those estimates. While Cassini is in between the planet and its rings, it can take measurements of Saturn’s gravity and mass without factoring in the rings. That measurement can then determine the mass of the rings.

Cassini’s grand finale

On September 15, 2017, Cassini will end its mission. But it will have one more trick up its sleeve. Having completed its ring passes, it will plunge into Saturn’s atmosphere — a place no spacecraft has been before. It’s a suicide mission: Cassini will try to send Earth some last bits of data before it breaks apart and burns, joining Saturn’s atmosphere for eternity.

“We’re going out in a blaze of glory,” Dyches says. Literally: Below, NASA animates what the crash will likely look like.

The death dive isn’t just for fireworks. It’s necessary. If Cassini doesn’t crash into Saturn, it runs the risk of potentially contaminating one of Saturn’s moons with debris and microbes from Earth. “Plunging it into Saturn ... is the safest” option, Dyches says.

Cassini’s dramatic finale is also a last chance to squeeze some more insights out of the 20-year-old spacecraft. As Cassini descends into the atmosphere, “several of the instruments will be on,” including the mass spectrometer, Dyches says. This instrument essentially can “sniff” the atmosphere and determine the chemical compounds it’s composed of.

“Nothing has ever gone into Saturn before,” he says. “We know that its atmosphere, from telescopes from the outside, [is] mostly hydrogen and helium — but there might be a sprinkling of other ingredients, heavier elements. We also don’t know how that composition varies with altitude.”

Meanwhile, with its last ounces of strength, Cassini will try to keep its antenna pointed toward the Earth for data transmission. But “the thrusters weren’t designed for this,” Dyches says. We won’t know how much information we’ll get until it happens.

"This planned conclusion for Cassini's journey was far and away the preferred choice for the mission's scientists," Linda Spilker, a Cassini project scientist at NASA’s Jet Propulsion Laboratory, said in a press statement. "Cassini will make some of its most extraordinary observations at the end of its long life."

Cassini is going out with a bang — but its whole run has been impressive

NASA has saved the ring-grazing orbits for Cassini’s finale in part because they are dangerous. The orbits will bring Cassini close to debris and rocks that could take it offline.

But the whole Cassini mission has provided key insights.

In 2004, Cassini became the first spacecraft to orbit Saturn, and it’s studied the planet’s magnetosphere and various moons. Cassini found evidence of an underground ocean on the moon Enceladus. It found that the moon Titan has surprisingly Earth-like geographic features and is peppered with great lakes of liquid natural gas on its surface that outweigh all the oil and gas reserves on Earth. It learned how new moons could form out of Saturn’s rings. And it has taken detailed, beautiful photographic surveys of Saturn’s rings and surface features.

When Cassini finally goes offline in September, it will die doing what it’s been doing all along: exploring.

Watch: The Pluto pics we waited 85 years for

Correction: This story originally misstated the date that Cassini will end its mission. The end date is September 15, 2017.