How to Get Rid of Drain Flies in Your Toilet

Drain flies in your toilet are breeding in the thin layer of organic sludge that coats the inside of your plumbing. Killing the adults you see won’t solve the problem. To get rid of them, you need to destroy the slime where larvae feed and seal any gaps that let flies travel from the pipes into your bathroom. Most infestations clear up within three to four weeks once the breeding site is eliminated.

Why Drain Flies Choose Your Toilet

Drain flies (sometimes called moth flies) are tiny, fuzzy-winged insects about the size of a fruit fly. They don’t bite, but they multiply fast. A female can lay eggs that hatch in less than two days at room temperature, and the full life cycle from egg to adult takes only 21 to 27 days. That means a small problem becomes a visible infestation quickly.

The larvae feed on the sticky biofilm of bacteria, algae, soap scum, and organic waste that naturally accumulates on the interior walls of drain pipes. This film is their entire food source, and it’s also their shelter. Larvae live embedded in it, which makes them surprisingly hard to kill with liquids alone. Any standing or slow-moving water in your plumbing system, from the toilet drain to the tank to underneath a leaking seal, can support this buildup.

Check for a Failed Wax Ring

If you see drain flies crawling out from the base of the toilet rather than from the bowl, you likely have a deteriorated wax ring. The wax ring is the seal between the bottom of your toilet and the drain pipe in the floor. When it fails, it creates a gap that lets sewer gases and insects travel up from the pipe into your bathroom, even if you never notice a water leak. Air can escape through this gap without any visible moisture on the floor.

Replacing the wax ring requires pulling the toilet off the floor, scraping away the old wax, and pressing a new ring into place before resetting the toilet. A standard wax ring without a plastic funnel attachment tends to seal best against irregular spots on the flange. This is a manageable DIY project if you’re comfortable lifting a toilet, but it’s also a common and inexpensive job for a plumber. Until you replace the ring, no amount of cleaning inside the drain will stop flies from emerging at the base.

Why Bleach and Boiling Water Don’t Work

Pouring bleach, vinegar, baking soda, or boiling water down the drain is one of the most common suggestions online, and one of the least effective. Drain fly larvae are protected by the sticky biofilm coating the pipe walls. Liquid poured down the drain flows through the center of the pipe without meaningfully contacting that film. The larvae stay embedded and keep feeding.

Boiling water carries an additional risk with toilets specifically. Porcelain is essentially a type of glass, and a sudden temperature shock can cause it to crack, especially if the bowl is cold. A cracked toilet bowl can collapse into jagged shards, creating a safety hazard. Even if the porcelain survives, the boiling water still won’t strip the biofilm off the pipe walls.

Clean the Drain With an Enzyme Product

The most effective approach is an enzyme-based or bacterial drain cleaner designed to break down organic buildup inside pipes. These products contain bacteria or enzymes that digest the sticky biofilm where drain fly larvae live and feed. Once the biofilm is gone, larvae have no food source, no shelter, and no surface to cling to. Adults that are already flying around will die within a few days on their own, since males live only a few days and females survive up to a week.

To use an enzyme cleaner in a toilet:

  • Apply at night. Pour the product into the toilet bowl and, if accessible, into the overflow tube in the tank. Nighttime application gives the enzymes hours of contact time without being flushed away.
  • Don’t flush until morning. The longer the product sits in contact with the pipe walls, the more biofilm it breaks down.
  • Repeat for several days. One application rarely eliminates a well-established biofilm. Most enzyme products recommend daily treatment for five to seven days, then periodic maintenance.

If you have a septic system, enzyme and bacterial drain cleaners are generally safe and can actually benefit the system by improving solids breakdown. Products marketed as septic-safe use naturally occurring bacteria that target organic waste like grease, hair, and sewage without producing heat, fumes, or damage to pipes.

Manually Clean What You Can Reach

Enzyme cleaners work well inside the pipes you can’t see, but for areas you can access, physical cleaning speeds things up. Use a stiff toilet brush to scrub the inside of the bowl thoroughly, paying attention to the rim jets (the small holes under the toilet rim where water enters during a flush). Biofilm can accumulate in and around these openings.

If flies seem to be coming from the tank, remove the lid and inspect for slimy buildup on the walls, the flapper, or the overflow tube. Scrub any visible film with a brush and clean water. A toilet that isn’t flushed frequently, such as one in a guest bathroom, is especially prone to biofilm accumulation because the water sits undisturbed for long periods.

Prevent Them From Coming Back

Drain flies return when the conditions that attracted them return. A few habits make reinfestation unlikely:

  • Flush unused toilets regularly. If a toilet sits idle for days or weeks, flush it every couple of days to keep water moving and prevent biofilm from building up.
  • Run water in all drains. Floor drains, sink drains, and tub drains near the toilet can also serve as breeding sites. Running water through them weekly keeps the traps full and discourages egg-laying.
  • Use enzyme cleaners monthly. A maintenance dose once or twice a month prevents the organic film from reestablishing inside pipes.
  • Fix leaks promptly. Any moisture that pools beneath pipes, behind walls, or under the toilet base creates a potential breeding site. Even small, slow leaks that don’t cause visible water damage can sustain a drain fly population.

With the biofilm removed and the breeding sites sealed, the existing adults die off within a week. If you’re still seeing new flies after four weeks of consistent cleaning, the breeding source is likely somewhere you haven’t treated yet, such as a floor drain, a shower pan leak, or a pipe joint hidden behind a wall. At that point, a pest control professional can help pinpoint the location.