How to Get Rid of Gnats in the House: Find the Source, Then the Fix

Written by George Climer

The fastest way to get rid of gnats in your house is to find and destroy what they are breeding in, then trap the adults still flying around. Gnats do not really come from outside; they hatch indoors from damp potting soil (fungus gnats), the sludge inside a drain (drain flies), or rotting produce and spills (fruit flies). Spraying or trapping the adults without killing the breeding source just means a fresh batch hatches in a day or two. So the order that actually works is: identify which gnat you have, dry out or clean the source it is breeding in, and only then set vinegar or sticky traps to mop up the survivors.

Gnat problems peak in the warm, humid months of late spring and summer, when overwatered houseplants and slow drains breed them fastest. Below is how to tell the three common indoor gnats apart, the exact fix for each source, and the traps and sprays that clear out the adults. Once the source is gone, most infestations are over within 3 to 7 days.

A gnat infestation in the house

Which Gnat Do You Have? Quick Identification

The common types of gnats found in the house

“Gnat” is a catch-all word for several tiny flying insects, and the cure depends entirely on which one you have. Indoors, it is almost always one of these three. Match what you are seeing to the table, then jump to the fix for that source. Gnats are just one kind of fly, so for the whole family see how to get rid of flies.

GnatWhat it looks likeWhere it gathersBreeds in
Fungus gnatDark, slender, long legs, mosquito-like with long thin wingsAround houseplants, soil, and windowsDamp, overwatered potting soil
Fruit flyTan to brown, rounded, often red eyes, about 1/8 inchFruit bowls, trash, recycling, sinkRotting produce, spills, sugary residue
Drain flyFuzzy, moth-like, dark fluffy dot, sits on wallsBathroom and kitchen drains, walls nearbyThe slimy organic film inside drains

Less common indoor “gnats” include no-see-ums (biting midges), regular midges, sand gnats, eye gnats, and buffalo gnats, but those are mostly outdoor flying insects that wander in. If the bugs are hovering over your plants, around fruit, or near a drain, you are dealing with one of the three above. For lookalikes that are not actually fruit flies, see our guide to small black flying bugs that are not fruit flies, and our fruit flies vs gnats comparison.

Step 1: Find and Kill the Breeding Source

This is the step most people skip, and it is the only one that actually ends the infestation. Each gnat breeds in a different place, so treat the right source.

Fungus Gnats: Dry Out the Soil

Fungus gnat larvae live in the top inch or two of constantly damp potting soil, feeding on fungus and roots. The fix is to make that soil hostile to them:

  • Let the soil dry out. Stop watering until the top two inches are bone dry. The larvae and eggs cannot survive in dry soil, and this alone breaks most fungus gnat cycles.
  • Drench with hydrogen peroxide. Mix one part 3% hydrogen peroxide with four parts water and water the plant with it. It fizzes on contact, killing larvae in the soil, then breaks down harmlessly.
  • Top the soil. Add a half-inch layer of coarse sand or fine gravel so the surface dries fast and adults cannot reach the soil to lay eggs.
  • Water from the bottom. Going forward, water from the saucer so the top of the soil stays dry, and never let pots sit in standing water.

Related: Dark-Winged Fungus Gnat | Identification and Control

Fruit Flies: Remove the Food

Fruit flies breed on fermenting sugars, so the source is almost always food you can find and remove. Toss or refrigerate overripe fruit, take out the trash, rinse recycling before it sits, wipe up sticky spills, and check for the hidden culprits: a single soft onion or potato, a splash of juice under the fridge, or a film of beer or wine in a bottle. Clear those and the adults have nothing to lay eggs in.

Related: How to Get Rid of Fruit Flies for Good

Drain Flies: Scrub the Drain

Cleaning a drain to get rid of drain flies and gnats

Drain flies breed in the slimy biofilm coating the inside of a drainpipe, and this is where most people get it wrong. Pouring bleach or boiling water straight down often fails, because the liquid runs right past the sludge without removing it. You have to physically break up the film:

  1. Find the right drain. Tape a cup or piece of tape loosely over each suspect drain overnight. The drain where flies are stuck to the tape in the morning is the breeding one.
  2. Scrub the pipe. Run a stiff drain brush as far down as it reaches to scrape the gel-like biofilm off the pipe walls. This is the part that actually kills the eggs and larvae.
  3. Flush it. Pour in a half cup of baking soda followed by a half cup of white vinegar, let it foam for a few minutes, then chase it with very hot water.
  4. Sanitize. Once the pipe is clean, a diluted bleach rinse (a half-cup of bleach in a gallon of warm water) helps keep it that way. Repeat the scrub weekly until the flies are gone.

Related: How to Get Rid of Drain Flies

Step 2: Trap and Kill the Adults

With the source gone, you still need to catch the adults already flying. These traps and sprays handle the stragglers. Used on their own, without fixing the source, they only ever keep the population trimmed, never gone.

Apple Cider Vinegar Trap

The single most effective DIY trap for fruit flies and fungus gnats. Pour an inch of apple cider vinegar into a small cup, add a few drops of dish soap (which breaks the surface tension so the gnats sink), and set it near the activity. The scent draws them in and the soap drowns them. A jar of mashed rotten fruit with plastic wrap and a few pinholes poked in the top works the same way.

This video shows you how to make the trap:

Yellow Sticky Traps

Yellow sticky cards are the best tool for fungus gnats. Stand a few in the soil right at the pot, where adults take off and land, and they will catch wave after wave of emerging gnats. They also double as a monitor, telling you when the population is finally dropping. Stick-on plant traps and flypaper work the same way for any flying gnat.

Yellow Sticky Fruit Fly Trap 36 Pack, Dual-Sided Gnat Traps for Plants
  • Fruit fly traps for indoor: bright color attract flying insects,...
  • Easy to use yellow sticky traps: the fruit fly traps for indoors...
  • Safe flying insect trap: gnat traps for house indoor use bright...
  • Warm prompt: the temperatures rise in the summer, maybe causes...
  • Long lasting: gnats killer indoor trap paper with a very strong...

1
TERRO Fruit Fly Trap 4-Pack, 180 Day Lure Supply, Food-Based Lure
  • COMPREHENSIVE COVERAGE: 4-pack of TERRO fruit fly traps for...
  • FAST-ACTING CONTROL: The liquid bait attracts and eliminates...
  • DISCREET DESIGN: Apple-shaped fly trap indoor design blends...
  • LONG-LASTING PROTECTION: Each ready-to-use flying insect trap...
  • TARGET BREEDING AREAS: Place near fruit fly breeding areas to...
2
TERRO Fruit Fly Trap, 6-Pack Indoor Fly Traps with 270 Days Lure Supply
  • COMPREHENSIVE COVERAGE: 6-pack of TERRO fruit fly traps for...
  • FAST-ACTING CONTROL: The liquid bait attracts and eliminates...
  • DISCREET DESIGN: Apple-shaped fly trap indoor design blends...
  • LONG-LASTING PROTECTION: Each ready-to-use flying insect trap...
  • TARGET BREEDING AREAS: Place near fruit fly breeding areas to...

DIY Spray for Plants

To knock gnats off houseplants without harming them, mix water, a tablespoon of apple cider vinegar, a teaspoon of sugar, and a few drops of dish soap in a spray bottle. Mist the flying gnats directly. It is non-toxic to you, your kids, and your pets, and safe on the plant.

Bug Zapper

An indoor bug zapper or UV light trap draws gnats to the light, especially in a dark room, and kills them on contact. It is not the prettiest option, but it quietly thins a swarm overnight while you deal with the source.

Insecticide Sprays

Spraying to get rid of gnats in the house

If a swarm is heavy, a labeled household flying-insect spray drops the adults fast. Read the label and keep it away from food surfaces, and do not use it on the plants or soil themselves, where it can do more harm than the gnats. These are products we have had success with for the adults in the air:

Ortho Home Defense Flying Insect Killer Aerosol 16 oz
  • Kills flies; Gnats; mosquitoes and Small flying moths
  • Also kills listed insects on Ornamental plants
  • Indoor and outdoor use
  • Kills mosquitoes that may transmit West Nile virus and kills...
  • Kills aphids; whiteflies; Japanese beetles; mealy bugs;...

1
Stem Kills Flies, Mosquitoes And Gnats: Plant-Based Active Ingredient Bug Spray, Botanical Insecticide For Indoor And Outdoor Use; 10 fl oz (Pack Of 1)
  • Bug spray that quickly kills flies, mosquitoes and gnats
  • Plant-based active ingredient bug killer safe for use around...
  • Entomologist tested bug spray made with botanical extracts to...
  • Bug killer for indoor and outdoor use, wherever bugs try to...
  • Rooted in Nature, Optimized by Science
2
Kate's Garden Plant Spray for Insects & Getting Rid of Gnats. Fungus Gnat Killer & Bug Spray for Indoor Plants (16oz, Pet Safe, Non Toxic)
  • GNAT CONTROL FOR INDOOR PLANTS: Our powerful gnat spray for...
  • FUNGUS GNAT SPRAY FOR INDOOR PLANTS: This gnat spray is effective...
  • GNAT KILLER INDOOR: Made with natural ingredients in the USA; our...
  • NON-TOXIC PLANT GNAT TREATMENT: This peppermint oil spray for...
  • EASY TO USE PLANT BUG SPRAY: Shake the plant spray bottle well...

Green Gobbler Fruit Fly Goodbye Gel Drain Treatment | Killer Flies & Eliminator (1 Gallon)
  • KILL FRUIT, DRAIN & SEWER FLIES: Get rid of the fly infestation...
  • PERFECT FOR HOMES & BUSINESSES: Green Gobbler is perfect for...
  • EASY TO USE: Simply pour 8 ounces into your problem drain. This...
  • MADE WITH CITRONELLA & CINNAMON: Our formula contains natural...
  • GREEN GOBBLER GUARANTEE: Green Gobbler cares about its customers....

Natural Armor Drain Fly & Fruit Fly Killer (128oz Gallon)
  • ELIMINATES DRAIN FLIES, FRUIT FLIES, GNATS & SEWER FLIES – Our...
  • COMMERCIAL STRENGTH GEL FORMULA – Designed for homes and...
  • USE IN ANY INDOOR DRAIN – Ideal for kitchen sinks, bathroom...
  • SEPTIC & PLUMBING SAFE – Safe for drains, pipes, sewer lines...
  • TRUSTED FOR OVER 10 YEARS – For more than a decade, homeowners...

Ortho Home Defense Flying Bug Killer with Essential Oils 14 oz.
  • Safe and strong essential oil formula (Safe to use around kids...
  • Safe to use around kids and pets when used as directed
  • Tested and proven to start killing flying bugs in seconds**...
  • Use indoors or outdoors
  • Spray at all angles

Call a Professional

If you have cleaned the obvious sources and gnats keep coming back, the breeding site may be hidden, such as a leaking pipe inside a wall, a forgotten plant saucer, or a clogged condensate line. A pest control professional can track down the moisture source you cannot find and treat it.

Why Do I Have Gnats in My House?

What attracts gnats into the house

Most indoor gnats are not invaders from the yard; they hatched inside your home. A new houseplant often arrives with fungus gnat eggs already in the soil, supermarket produce can carry fruit fly eggs, and drains quietly grow the film drain flies breed in. Add the warmth and moisture of a kitchen or bathroom and a couple of gnats become a swarm within a week. They are drawn to sweet and fermenting smells (fruit, garbage, sugary spills) and to damp, dark spots like sink drains and overwatered pots.

Because they are only 1/8 to 1/4 inch (3 to 6 mm) long, gnats also slip in through window screens, door gaps, and cracks, especially at night when your lit windows act like a beacon. But the ones that turn into an infestation are the ones that found a damp place inside to breed.

How to Keep Gnats From Coming Back

Home remedies and prevention to keep gnats out of the house

Once the gnats are gone, a few habits keep them from returning:

  • Stop overwatering plants. Let the top inch or two of soil dry between waterings, the single biggest fungus gnat preventive.
  • Store ripe fruit in the fridge and toss anything starting to turn.
  • Take out the trash often and rinse recycling before it sits.
  • Run hot water and a baking-soda-and-vinegar flush through drains weekly to stop the biofilm from rebuilding.
  • Wipe up spills and crumbs, and keep sink and counter surfaces dry overnight.
  • Repair torn window screens and seal gaps around doors and windows.

Gnats also dislike peppermint, so a few cotton balls dabbed with peppermint essential oil near plants or drains, or candles scented with lemon, citronella, lavender, or vanilla, can help deter the strays.

Related: How to Get Rid of Gnats and Fruit Flies Using Essential Oils

Frequently Asked Questions

What is the fastest way to get rid of gnats?

Kill the breeding source first, then trap the adults. For fungus gnats, let the plant soil dry out and drench it with diluted hydrogen peroxide; for fruit flies, remove rotting produce and spills; for drain flies, scrub the drain. Then set an apple cider vinegar and dish soap trap to catch the remaining adults. Skipping the source means a new batch hatches within days.

Why do I keep getting gnats even after cleaning?

You have almost certainly missed a breeding site. The usual hidden culprits are an overwatered plant, a single drain you did not scrub, a soft onion or potato in the pantry, or moisture inside a wall or under the fridge. Until every damp breeding spot is dried out or cleaned, the gnats keep regenerating.

How long does it take to get rid of gnats?

Once the breeding source is removed, most infestations clear in about 3 to 7 days as the last adults die off. Fungus gnats can take a little longer because eggs already in the soil keep hatching, so keep the soil dry and the sticky traps in place for two to three weeks.

Are gnats in the house harmful?

Fungus gnats, fruit flies, and drain flies do not bite people and are mainly a nuisance, though fruit flies can carry bacteria from rotting food to surfaces. Fungus gnat larvae can damage seedlings and houseplant roots in heavy numbers. The biting “gnats” people worry about are no-see-ums and buffalo gnats, which are outdoor insects.

Does diluted bleach in the drain get rid of gnats?

Only partly. Bleach can sanitize but it tends to run straight past the biofilm that drain flies actually breed in, so it does not remove the source. You have to physically scrub the inside of the pipe with a drain brush first; the bleach rinse is a finishing step, not the fix.

List of Sources

Bethke, J. A., & Dreistadt, S. H. (2013). Pests in Gardens and Landscapes: Fungus Gnats, University of California IPM
Cranshaw, W. S., & Peairs, F. B. (2017). Flies in the Home, Colorado State University Extension
Potter, M. F. (1994). Fruit Flies, University of Kentucky Entomology
Townsend, L. (1997). Midges and Gnats, University of Kentucky Entomology
Waldvogel, M., Alder, P., & Crawley, S. (2016). Fungus Gnats Indoors, NC State Extension