Perovskite solar cells have rapidly advanced towards high power conversion efficiencies, yet their sensitivity to moisture, oxygen, heat and mechanical stress has hindered long-term operation.