How long do I have to boil water to make it safe?

Depends. As an outdoorsman of 40+ years, I see a lot of bad advice about making water safe. The cdc's official advice is this: at low altitudes boil vigorously for 1 minute. At altitudes greater than 6, 562 feet (>2, 000 m), boil for 3 minutes, or use chemical disinfection after it has been boiled for 1 minute. Because boiled water is bland and tasteless, add a pinch of salt to make it more palatable.
Boiling water. The fact is, with a water temperature of 160 to 165 degrees f (74 c) it takes just half an hour for all disease causing organisms to be inactivated. At 185 degrees this is cut to just a few minutes. By the time water hits its boiling point of 212 f (100 c) – plus or minus depending upon pressure or altitude – the water is safe.