Here are the basics for a healthy, full-term baby. (You’ll need to be a little more careful for preemies and special needs or hospitalized babies. In these cases, ask your hospital for their policy.)
Room temperature: 6 to 8 hours
Insulated cooler with ice packs: up to 24 hours
Refrigerator: 5 to 8 days
Freezer inside refrigerator: up to 2 weeks
Freezer with separate door: 3 to 6 months
Stand-alone deep freezer: 6 to 12 months
To maximize shelf life, try to keep milk in the back part of your fridge (away from the door, where temps change frequently) or in the middle of your freezer (away from freezer walls, which can let in some warmth).