Food safety when the power goes out
Quick answer: keep the doors shut. Food stays safe for about 4 hours in a closed refrigerator, 48 hours in a full freezer, and 24 hours in a half-full one. When in doubt, throw it out. (Centers for Disease Control and Prevention)

Before an outage
Keep an appliance thermometer in the refrigerator and one in the freezer. The refrigerator should read 40°F or below and the freezer 0°F or below. Freeze a few containers of water or gel packs, and keep a cooler handy. (Centers for Disease Control and Prevention)
During the outage
Keep the refrigerator and freezer closed. After 4 hours without power, move milk, meat, leftovers, and other perishable food into a cooler with ice or frozen gel packs. (Centers for Disease Control and Prevention) Eat food from the refrigerator first, then the freezer, then the pantry. (FEMA and the American Red Cross)
After the power comes back
- Throw out perishable food that sat at 40°F or warmer for 2 hours or more. (Ready.gov (FEMA))
- Frozen food that still has ice crystals or reads 40°F or below can be refrozen or cooked. (Centers for Disease Control and Prevention)
- Throw out anything with an odd smell, color, or texture. Never taste food to decide. (Centers for Disease Control and Prevention)
After a flood
Throw out food that may have touched floodwater, food in cardboard or packages that are not waterproof, home-canned food, and cans that are bulging, open, or damaged. (Centers for Disease Control and Prevention)
Medicine in the refrigerator
Some medicines need to stay cold. Find out ahead of time how long yours keeps at higher temperatures. (Ready.gov (FEMA)) The power outage planner adds refrigerated medicine and the fridge and freezer to a printable checklist.
The free 72-hour household plan keeps the refrigerator and freezer times on one page. Every number on this page is listed with its source on the sources page.