Home & Cleaning 8 min read Easy 6 steps

How to Get Rid of Gnats

Tell fungus gnats from drain flies and fruit flies, clear the soil or drain they breed in, and trap the adults while the last eggs hatch.

Published · Last updated
Healthy houseplant on a bright windowsill

You will end up knowing which gnat you have, where it breeds, and how to clear that spot, since that is where its eggs and larvae live. "Gnats" is a catch-all name for tiny flying insects, and the ones in your home can be different species with different breeding habits.

Fungus gnats live in houseplant soil. Drain flies, also called moth flies, breed in the organic film inside drains. Fruit flies get mistaken for both, and each of the three needs a different fix.

Step 1 shows you how to tell them apart by where they gather, so you treat the right source first.

What you’ll need

For fungus gnats, you need yellow sticky traps, a raw potato for checking the soil, and coarse sand or fine gravel, plus a Bti product (Mosquito Bits or Gnatrol) if drying the soil is not enough. For drain flies, you need a stiff, long-handled brush, an enzyme drain cleaner, a clear plastic container, and a sticky trap. For fruit flies, you need a small jar, apple cider vinegar, and dish soap.

1

Identify which type of gnat you have

Watch where the gnats congregate. This tells you which species you are dealing with. Fungus gnats hover around houseplants, especially when you water them. They are small, dark, and have a somewhat erratic flying pattern. Drain flies (also called moth flies) are found near bathroom or kitchen drains. They are fuzzy, slightly triangular, and tend to rest on walls near sinks. They look more like tiny moths than flies. Fruit flies are tan or brownish with red eyes and cluster around fruit, trash, or fermented liquids. Once you know the type, treat only its breeding source. If they are fruit flies, follow our guide on how to get rid of fruit flies instead, because they breed in fermenting fruit and trash.

2

For fungus gnats, dry out the soil and use sticky traps

Fungus gnat larvae live in moist potting soil, where they feed on fungi, organic matter, and root hairs. Start with the watering, which Oklahoma State University Extension calls the most important nonchemical step. Let the top inch of soil dry out before you water again, or water from the bottom so the surface stays dry. Do not dry the whole pot out, because too little water wilts a plant just as too much does. Stick yellow sticky traps into the soil surface of affected plants. Adults are attracted to the yellow color, land on the adhesive, and get stuck. Replace a trap when its surface is covered. To check the soil itself, press a slice of raw potato onto the surface and look underneath after 3 to 4 days. Larvae on the slice mean the soil is still infested. UC IPM puts a full fungus gnat generation at about 17 days at 75°F, with many overlapping generations running at once. The same Oklahoma State column puts getting fungus gnats in check at 3 to 4 weeks of changed watering and a sand or gravel top layer, because you are waiting out the eggs already in the soil.

Good to know: A layer of coarse sand or fine gravel about 1 inch deep on top of the potting soil keeps the surface drier and makes it less attractive to egg-laying females, according to the same Oklahoma State column. Keep it on any plant that has had fungus gnats before.

3

For drain flies, clean the organic buildup inside the drain

Drain flies breed in the slimy organic film that coats the inside of drains, especially in bathrooms where hair, soap scum, and skin cells accumulate. Any pocket of standing organic sludge will do, so the drain is the first place to look rather than the only one. Spraying the adults will not end it, because the eggs, larvae, and pupae live in that film where sprays cannot reach. Ohio State University Extension says the film is best removed with an enzyme drain cleaner, and that bleach does not clear it. Remove the drain cover and scrub the inside of the pipe as far as you can reach with a stiff, long-handled brush. Before you flush it, check your pipes. If they are plastic (white PVC or black ABS), use very hot tap water rather than boiling, because both are rated to a maximum operating temperature of 140°F and boiling water is 212°F. Flush the scrubbed pipe with hot water, then pour in the enzyme cleaner and follow its label. Ohio State notes these cleaners can be hard to find in stores, so check a janitorial supply shop or buy online. Baking soda and vinegar are a weaker substitute. The fizzing is an acid and a base neutralizing each other into salty water and carbon dioxide gas, so it loosens the film rather than digesting it. To check your work, tape a sticky trap inside a clear plastic container and set it upside down over the drain overnight, as Ohio State describes. Flies on the trap in the morning mean the drain is still breeding them, so scrub and treat it again.

4

Trap the flying adults while the source clears

While the source clears, trap the adults that are already flying so fewer of them lay eggs. Match the trap to the insect. For fungus gnats, use the yellow sticky traps from step 2, because the same Oklahoma State column says vinegar traps, the usual fruit fly method, do not work on them. For drain flies, use the overnight container trap from step 3. For fruit flies, pour half an inch of apple cider vinegar into a small jar, add 2 to 3 drops of dish soap to break the surface tension, and set it next to the fruit or trash they gather around. Traps only thin out the adults. The source cleanup in steps 2, 3, and 5 is what ends the infestation.

5

For stubborn fungus gnats, drench the soil with Bti

If drying out the soil is not practical (some tropical plants cannot tolerate dry periods) or the potato checks keep finding larvae, treat the larvae directly with Bti, a biological insecticide sold as Mosquito Bits and Gnatrol. UC IPM points home gardeners to Bti because the products are sold at retail nurseries and garden centers, and says it is toxic only to fly larvae. It does not touch eggs, pupae, or adults, so Oklahoma State says to repeat it 5 to 7 days apart until the infestation is under control, applied with enough water to soak down to the larvae. Follow the label for quantities, because the products differ. Hydrogen peroxide is the common home alternative. Mix one part 3% hydrogen peroxide (the standard drugstore kind) with four parts water and use it in place of a normal watering. It breaks down into water and oxygen. We could not find a published study testing it on fungus gnats, so use it only if you cannot get Bti, and test it on one pot first.

6

Prevent future gnat problems

For fungus gnats, avoid overwatering houseplants. Let the top inch of soil dry between waterings. Use well-draining potting mix. Empty saucers under pots after watering so plants do not sit in standing water. For drain flies, scrub your drains and treat them with an enzyme cleaner monthly, following the same pipe caution as step 3. Do not let hair and soap scum build up. For all types, empty and clean pet water bowls daily. Fix leaky faucets and pipes that create standing water. Clean up any organic debris promptly.

Fungus gnats take the longest. A generation runs about 17 days and the generations overlap, so plan on the 3 to 4 weeks from step 2. Drain fly adults live about 2 weeks, according to Ohio State, so a few can keep appearing after the drain is clean. Trust the overnight trap from step 3 over what you see on the walls. If you have treated the correct source and still see gnats after a month, look for a second breeding site. Check your other drains and plants, the garbage disposal (FAQ 4 below), wet lint under the washing machine, and any saucer or container holding standing water.

Questions we get asked about this

Answers from experience, not a textbook.

Fungus gnats are not harmful to you. UC IPM says adult fungus gnats do not damage plants or bite people and are primarily a nuisance, while the larvae in large numbers can damage roots and stunt growth, particularly in seedlings and young plants. So your plant has more to worry about than you do. Drain flies do not bite either, but Ohio State University Extension notes that they come from filthy film, so they can carry microbes onto surfaces, and that inhaling dust from dead flies can trigger bronchial asthma. Keep them away from food surfaces.

Indoor fungus gnats and drain flies are weak fliers. UC IPM says fungus gnats usually stay near potted plants and fly toward light, and Ohio State describes drain flies making short, jerky flights of a few feet. We could not find a study showing that either one targets people. Because they fly so little, gnats that keep turning up around you indoors point to a breeding site nearby. Find it and clear it with step 2 or step 3, because swatting and repellents do nothing about the larvae.

UV bug zappers catch some adults but will not end an infestation, because the larvae keep developing in the soil or the drain. Ohio State University Extension says the same about UV traps and fly paper for drain flies. Put sticky traps right at the source instead, in the plant pot or over the drain, where they catch new adults as they emerge.

Yes. Garbage disposals accumulate organic residue on the splash guard (the rubber flap), the grinding chamber walls, and the pipe immediately below. This residue is an ideal breeding ground for both fruit flies and drain flies. Run cold water before you turn the disposal on, and keep it running for several seconds after grinding to flush the drain line, as InSinkErator's manual says. Clean the splash guard by lifting the flaps and scrubbing the underside with a brush and dish soap. Treat it with the enzyme drain cleaner from step 3 whenever you treat your other drains.

Not if the roots are healthy. Slide the plant out of its pot and look. Firm, light-colored roots mean the plant can be saved. If the roots are brown and mushy and the plant wilts in damp soil, the damage has gone too far, and UC IPM says tossing a severely infested plant is sometimes the right call. To save it, shake off as much of the old soil as possible and repot in fresh potting mix labeled pasteurized or sterilized, which is the only kind UC IPM recommends. Discard the old soil outside (not in an indoor trash can). Keep the plant away from your other pots while it recovers, because adults emerging from it can infest them. Then add the sand layer from step 2.

Like this?

We write one of these every week.

Subscribe for one useful thing a week. Read it over coffee, skip the rest.