Gamma ray burst
When a supernova explodes, it unleashes a massive gamma ray, or high-frequency electromagnetic radiation. Most of these huge bursts of energy take place too far away to harm Earth, but if one occurred within 30 lightyears from the sun — which is pretty close on the cosmic scale — it would be disastrous. The gamma ray would blow apart a portion of the planet’s atmosphere, produce worldwide fires and kill most of Earth’s species in just a matter of months.
However, the odds of a gamma ray burst destroying the planet are extremely low because not only would the supernova need to be close to Earth, the explosion would also have to be pointed in Earth’s direction. Fortunately, there are few high-mass stars with the potential to explode.