Purifying rainwater is a chain of steps, not a single device: keep the worst material out at the roof, settle and filter what still gets in, then disinfect before anyone drinks it. Rain itself is close to distilled when it leaves the cloud, and almost everything you are treating for is picked up from the roof, the gutter and the tank.
Start at the roof, because that is where the load comes from
Leaves, grit, bird and rodent droppings, moss and roofing residue are the actual contaminants in a rain barrel. Gutter guards and a leaf screen at the tank inlet take out the coarse material. A first-flush diverter discards the initial run of each storm, which carries most of what settled on the roof between rains. Nothing downstream is cheaper or more effective than these two, and a system without them will overwhelm any filter you fit.
Settle, then filter in stages
Let the tank do the first job: a calm inlet and a floating draw-off point mean you take water from the cleanest layer rather than from the sediment on the floor. After the pump, run a coarse sediment cartridge to catch grit, then a finer one, then activated carbon for color, taste and organic compounds. Staging matters because a fine cartridge on unsettled water blocks within days and you end up changing cartridges rather than treating water.
Disinfection is the step that makes it drinkable
Filtration removes particles and improves taste; it does not reliably remove bacteria, viruses or protozoa. For drinking, either boil, or run an ultraviolet unit sized for the flow, or dose chlorine and allow contact time. Ultraviolet is the usual household choice, and it only works on water that is already clear, because particles shade organisms from the lamp. That is why the ultraviolet unit always sits last, after the filters.
Be realistic about what is not covered
The EPA notes that private wells are not federally regulated under the Safe Drinking Water Act, and a rain barrel sits even further outside that framework: nobody samples it, and no standard applies to it. Check your state and local rules, since some jurisdictions restrict potable rainwater use. If you intend to drink it, treat it like a private supply and have the tank water tested by a laboratory once the system is running, then repeat annually.
Questions people ask about how to purify rainwater
Is rainwater safe to drink straight from a barrel?
No. Roof runoff carries bacteria from droppings and debris, so it needs filtering and disinfection before anyone drinks it.
Does boiling rainwater make it safe?
Boiling deals with the microbes, which is the main risk, but it does nothing about dissolved metals from roofing materials or the sediment you should be filtering out anyway.
Can I use rainwater for laundry and the garden without treating it?
Screened and settled rainwater is widely used for irrigation and outdoor washing. Any indoor plumbed use should still be filtered, and clearly labeled if it is not potable.