Flexible solid-state zinc-air batteries (ZABs) generally suffer from poor electrolyte/electrode contact and mechanical degradation in practical applications. In addition, CO2 corrosion is also a common issue for ZABs with alkaline electrolyte. Herein, we report a thermoreversible alkaline hydrogel electrolyte that can simultaneously solve the aforementioned problems. Through a simple cooling process, the hydrogel electrolyte transforms from solid state to liquid state that can not only restore the deformed electrolyte layer to its original state but also rebuild intimate contact between electrode and electrolyte. Moreover, the ZAB based on this hydrogel electrolyte exhibits an unprecedented anti-CO2 property. As a result, such a battery shows almost 2.5 times discharge duration than that of ZAB based on liquid electrolyte.