Depending on certain factors, a keg can last you anywhere from a single day to around 17 weeks, with the biggest factor being whether the beer has been pasteurized or not.
Pasteurized beer lasts three to four months in a tapped keg. Non-pasteurized beer, on the other hand, lasts around two months tops — and sometimes as little as a week to 20 days.
The method used to tap a keg matters, too. A keg tapped with a manual pump, a.k.a. a party pump, will only last a day, as it pumps outside air into the keg to force the beer out.
When outside air enters the keg, the consequent oxygen exposure rapidly degrades the beer’s flavor. The outside air can also contain bacteria that might spoil the drink faster.
If you use a jockey box or a kegerator, which utilizes a pressurized CO2 tank to dispense beer without letting any air from the outside get in the keg, it can stay fresh for months.
The last factor is the temperature your keg is kept in, which should ideally be 38° F. Temperatures over 55° F can trigger bacterial growth and under 28° F can freeze your beer.