Those small black worms in your toilet are almost certainly the larvae of drain flies, also called moth flies. They’re about 3/8 inch long, legless, and grayish-black with darker ends. They thrive in the slimy organic buildup inside your toilet’s internal trap and the pipes connected to it. Getting rid of them requires removing that slime, not just killing the worms you can see.
What You’re Actually Looking At
Drain fly larvae are the most common “black worms” found in toilets. They feed on the gelatinous film of bacteria, hair, soap residue, and waste that accumulates inside pipes and traps. Adult drain flies are tiny, fuzzy, moth-like insects you might notice on bathroom walls or ceilings, especially at night. If you’re seeing both the worms and those small flies, that confirms the identification.
Less commonly, the worms might be bright red instead of dark. These are midge fly larvae, often called bloodworms because of their color. They feed on the same organic gunk and require the same removal approach. In rare cases, actual earthworms show up in a toilet bowl. That’s a different problem entirely: earthworms entering your plumbing typically signal a crack in your sewer pipe, and you’ll need a plumber rather than a cleaning brush.
Why Bleach Won’t Fix This
Most people reach for bleach first, and it seems logical. But bleach is largely ineffective against drain fly larvae. The problem is physics: liquid bleach follows gravity straight down the pipe, barely contacting the thick biofilm coating the sides where larvae and eggs are embedded. Insect eggs can tolerate bleach exposure, particularly when they’re buried deep in that organic layer. The University of Minnesota Extension is blunt about this: there is no benefit to treating drains with chlorine bleach or ammonia.
The biofilm itself is the food source, the breeding ground, and the protective shield all in one. Until you physically remove it, new generations of larvae will keep appearing no matter what chemicals you pour in.
The Cleaning Method That Works
Mechanical scrubbing is the core of the solution. You need a stiff, long-handled brush that can reach into the toilet’s internal trap and the drain opening. The goal is to physically break up and remove the organic sludge clinging to pipe walls.
Start by scrubbing the interior of the toilet bowl thoroughly, paying attention to the area under the rim where buildup hides. Then work the brush into the drain opening as far as it will reach. For the connecting pipes, a long pipe-cleaning brush (sometimes called a drain brush) gets deeper than a standard toilet brush can. After scrubbing, flush the lines with boiling water to wash away loosened material. Pour slowly so the heat has time to work on remaining residue.
A few practical notes on boiling water: it’s most effective when poured in the evening, after the toilet hasn’t been used for several hours, so the water sits in contact with the pipe walls longer. ABS and PVC pipes can handle temperatures up to about 180°F, which is slightly below a full boil. One slow pour of recently boiled water is fine, but avoid repeatedly flooding plastic pipes with sustained boiling water. If you have older metal pipes, this isn’t a concern.
Repeat for Three Weeks
One cleaning session won’t end the problem. Drain fly eggs you missed will hatch, and the biofilm starts rebuilding almost immediately. Plan on repeating the scrub-and-flush routine every few days for at least three weeks. That timeframe covers the full life cycle from egg to adult, ensuring you catch each new generation before it can reproduce. The University of Arkansas Extension notes that control requires thorough cleaning and maintenance for three weeks or longer to break the cycle.
During this period, check every drain in the bathroom, not just the toilet. Larvae populations often breed in multiple drains simultaneously. The shower drain, sink overflow hole, and floor drains are all potential secondary sites. If you’re only cleaning the toilet while larvae are also thriving in the shower drain three feet away, adults will keep laying eggs in both locations.
When the Problem Points to Broken Pipes
If you’ve done thorough, repeated cleaning of every drain in the area and the worms keep coming back, the likely cause is a broken pipe or a leak you can’t reach. A crack in a sewer line under a concrete slab or in a crawlspace creates a hidden pocket of moisture and organic matter, a perfect breeding site that no amount of drain brushing will touch. An ongoing or recurring infestation despite careful cleaning of all drains is a classic sign of this kind of structural issue.
This is also the explanation when earthworms appear in a toilet. Earthworms live in soil and have no reason to be inside plumbing unless there’s a gap in the pipe underground that lets them crawl in. In either scenario, a plumber with a camera inspection tool can locate the break and recommend a repair.
Keeping Them From Coming Back
Once you’ve broken the cycle, prevention is straightforward. Clean your toilet thoroughly at least once a week, including under the rim. Flush toilets that don’t get regular use (guest bathrooms, basement half-baths) at least a couple of times per week. Stagnant water and undisturbed pipes are where biofilm builds fastest.
Check that all drain seals and wax rings are intact. If you notice small moth-like flies near the toilet again, treat it as an early warning and do a deep scrub before larvae have time to establish. Outside the home, look for open sewer vents or inspection ports, pooling water near the foundation, or areas where algae and mold grow on soil near the house. These outdoor conditions can support drain fly populations that eventually find their way inside.
For homes with septic systems, stick with mechanical cleaning and enzyme-based drain cleaners rather than harsh chemicals. Bleach and ammonia don’t help with the larvae anyway, and they can disrupt the bacterial balance your septic system needs to function.

