Although life is probably widespread in the universe, our pale blue dot, Earth, is the only known place harbouring intelligent life. Even if we manage to stave off extinction by climate change, avoid a nuclear apocalypse and the dangers of runaway AI, biological life on our planet will eventually come to an end in about 5 billion years’ time. What are the astrophysical dangers to life on Earth, and the prospects for life’s survival into the distant future?