How to Get Rid of Gnats
Identify which type of gnat you have and eliminate them at the source. Covers fungus gnats, drain flies, and general prevention.
"Gnats" is a catch-all term people use for any tiny flying insect that is not a fruit fly. But the insects grouped under that label are actually different species with different breeding habits, and the solution depends entirely on which one you have.
The three most common indoor gnats are fungus gnats (which live in houseplant soil), drain flies (which breed in the organic film inside drains), and the occasional fruit fly that gets misidentified. Each one breeds in a different place, responds to different traps, and requires a different elimination approach.
Identifying the type takes about 30 seconds and saves you from wasting time on the wrong treatment.
For fungus gnats, you need yellow sticky traps (garden centers and online shops both carry them, usually in multipacks) and a way to let your soil dry out. For drain flies, baking soda, white vinegar, and boiling water. A small bowl and apple cider vinegar make a backup trap for flying adults.
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 identify the type, focus your treatment on their specific breeding source.
For fungus gnats, dry out the soil and use sticky traps
Fungus gnat larvae live in the top 2 to 3 inches of moist potting soil, where they feed on organic matter and fungi. The most effective treatment is letting the soil dry out completely between waterings. This kills larvae, which need moisture to survive. 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 traps every 1 to 2 weeks. UC IPM puts a full fungus gnat generation at about 17 days at 75°F, with many overlapping generations running at once, which is why this takes 2 to 3 weeks rather than 2 to 3 days. You are waiting out the eggs already in the soil, not just killing what is in the air.
Good to know: A layer of coarse sand or decorative gravel (about half an inch) on top of the potting soil creates a physical barrier that prevents adult gnats from reaching the soil to lay eggs. It also makes the surface dry faster, which discourages larvae. This is a long-term preventive measure for any plant prone to fungus gnats.
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. Killing the adults does nothing because the larvae are inside the pipe where sprays cannot reach. To eliminate them, remove the drain cover and scrub the visible interior with a stiff brush. Pour boiling water slowly down the drain, followed by half a cup of baking soda and half a cup of white vinegar. Let it fizz for 15 minutes, then flush with more hot water. Repeat every 2 to 3 days for a week. Two caveats. 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, which is why the scrubbing above and the enzymatic cleaner below do most of the work. And if your drain pipes are plastic (white PVC or black ABS), use very hot tap water rather than boiling. Both are rated to a maximum operating temperature of 140°F, boiling water is 212°F, and this is a treatment you are repeating all week. Enzymatic drain cleaners (like Drain Gel or InVade Bio Drain) are particularly effective because they digest the organic film that drain flies depend on.
Set up vinegar traps for remaining adults
While you address the breeding source, set vinegar traps to catch the adults that are already flying around. Pour half an inch of apple cider vinegar into a small jar or bowl. Add 2 to 3 drops of dish soap to break the surface tension. Place traps near the affected area (next to plants for fungus gnats, near drains for drain flies). Apple cider vinegar works best on fruit flies. For fungus gnats the yellow sticky traps in step 2 are the tool with the research behind them, so treat a vinegar bowl as a supplement there rather than your main move. Either way this does not solve the problem by itself. It only thins out the adults while your source elimination does the real work.
For fungus gnats, use a hydrogen peroxide soil drench
If drying out the soil is not practical (some tropical plants cannot tolerate dry periods), use a hydrogen peroxide soil drench to kill larvae without harming the plant. Mix one part 3% hydrogen peroxide (the standard drugstore kind) with four parts water. Water your plants with this mixture instead of plain water. The hydrogen peroxide fizzes on contact with organic material in the soil, killing larvae and eggs. It breaks down into water and oxygen, and at that dilution it is gentle enough for most houseplants, though test one pot first if the plant is a fussy one. Use it once per week for 3 to 4 weeks to catch every stage of the lifecycle. If you would rather use something with research behind it, UC IPM points home gardeners at Bti, a biological insecticide sold as Mosquito Bits or Gnatrol, and calls those products the most convenient of the biological options. Follow the label for quantities, because the products differ.
Prevent future gnat problems
For fungus gnats, avoid overwatering houseplants. Let the top inch or two of soil dry between waterings for most plants. Use well-draining potting mix. Empty saucers under pots after watering so plants do not sit in standing water. For drain flies, clean drains monthly with hot water and the baking soda and vinegar method, 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 are the slow one, and it is worth knowing that before you start. A generation runs about 17 days and the generations overlap, so expect 2 to 3 weeks of steady treatment, and up to 4 if you are using the peroxide or Bti route in step 5. You are waiting out eggs that were already in the soil on day one. Drain flies disappear quickly once the drain is cleaned because their lifecycle depends entirely on the organic film inside the pipe. If you have treated the correct source and are still seeing gnats after a month, you probably have a secondary breeding site. Check other drains, other plants, or areas with standing water that you overlooked initially.
Questions we get asked about this
Answers from experience, not a textbook.
Not to you, in any way that is likely to matter. 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 they do breed in the film inside pipes, which is a good reason to keep them away from food surfaces.
Gnats are attracted to carbon dioxide, moisture, and warmth, all of which your face produces. They also tend to fly toward light-colored surfaces. They are not targeting you specifically. They are following chemical signals. The best way to deal with this is eliminating the breeding source so there are no gnats to bother you, rather than trying to repel individual insects.
UV bug zappers attract some gnats but are not effective for indoor use. They kill the adults they catch but do nothing about the breeding source, so new adults replace them continuously. Sticky traps are more effective indoors because they can be placed directly at the breeding site (in plant soil or near drains) where they intercept adults before they can lay new eggs.
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 the disposal with plenty of cold water every time you use it. Clean the splash guard by lifting the flaps and scrubbing the underside with a brush and dish soap. Flush periodically with the baking soda and vinegar method.
No. The plant is salvageable. Repotting in fresh, dry soil is the fastest fix. Remove the plant from its pot, shake off as much of the old soil as possible, and repot in new potting mix. Discard the old soil outside (not in an indoor trash can). Then apply the hydrogen peroxide drench to the new soil as a preventive measure. Add a layer of sand or gravel on top.
Pest Control Pro
How to Get Rid of Ants
How to Get Rid of Fruit Flies
How to Get Rid of Gnats
← you’re hereHow to Get Rid of Mice
How to Get Rid of Roaches