How to Get Rid of Gnats

Updated October 22, 202613 min read

In this guide18 sections
  1. 1Gnat control at a glance
  2. 2How to get rid of gnats in the house, step by step
  3. 3Which small fly do you have?
  4. 4Why is my house full of gnats all of a sudden?
  5. 5How do you get rid of gnats on plants?
  6. 6How long does it take to get rid of gnats on plants?
  7. 7How do you get rid of gnats in drains?
  8. 8How do you get rid of gnats and fruit flies naturally?
  9. 9How do you get rid of gnats overnight?
  10. 10Does gnat spray work?
  11. 11What is the best gnat killer for indoors?
  12. 12Does Dawn and vinegar get rid of gnats?
  13. 13How do you get rid of gnats outside?
  14. 14Are gnat treatments safe around pets, kids and fish?
  15. 15Why do gnats keep coming back?
  16. 16When should you call a pro or a plumber?
  17. 17Quick answers to common questions
  18. 18Is it hard to get rid of gnats for good?

Find out which gnat you have, then treat where it breeds. Gnats are not one pest. The tiny flies in your plants, your drains and your fruit bowl live in different places and need different fixes. Dry out the soil for plant gnats, scrub the pipe for drain flies, and clear the rotting food for fruit flies. Traps for the adults help, but they never finish the job alone.

Gnat control at a glance

Question Short answer
What are "gnats" indoors? Usually fungus gnats, drain flies, phorid flies or fruit flies
First step Work out which one you have and where it breeds
Plant gnats Let the top of the soil dry, add sticky cards, drench with Bti
Drain flies Scrub the pipe, then use an enzyme gel overnight
Fruit flies Remove ripe food and wet trash, then set a vinegar trap
Fastest relief tonight Sticky cards and traps near the source
Time to clear a plant infestation About 3 to 4 weeks, sometimes longer
Does a vinegar trap work on all gnats? No. It catches fruit flies, not fungus gnats

How to get rid of gnats in the house, step by step

Start by finding the source, then remove it, then trap what is left. Doing it in that order matters. A trap placed beside a wet plant or a slimy drain just keeps catching new flies, while the larvae keep making more.

  1. Identify the fly. Use the chart below. This one step decides everything that follows.
  2. Find the breeding spot. Check plant soil, drains, the trash, ripe food, pet bowls and anything damp.
  3. Remove or fix it. Dry the soil, scrub the drain, throw out the rotten food, fix the leak.
  4. Trap the adults. Use yellow sticky cards for plant gnats and a vinegar trap for fruit flies.
  5. Treat the larvae. Use Bti in soil, or an enzyme gel in drains.
  6. Keep going for three to four weeks. Gnats breed in cycles, so stopping when the flies disappear for two days brings them back.

Which small fly do you have?

Look at where the flies sit and how they move. Fungus gnats hover around plants and look like tiny mosquitoes. Fruit flies are tan with red eyes and cluster around fruit and trash. Drain flies have fuzzy, moth-like wings and rest on walls near sinks. Phorid flies run fast across surfaces instead of flying away.

Small dark fungus gnats near a houseplant
Match the fly to where you see it.
Fly Looks like Where you see it What works
Fungus gnat Slim, dark, long legs, like a tiny mosquito Over houseplant soil, windows near plants Dry the soil, Bti, sticky cards
Fruit fly Tan body, red eyes, round Fruit, trash, drains, spills Clean up, vinegar trap
Drain fly Fuzzy gray wings, moth-like Walls and ceilings near drains Scrub the pipe, enzyme gel
Phorid fly Small, humpbacked, runs in short dashes Floors, counters, damp corners, drains Find the rotting source or leak
Outdoor midge or eye gnat Tiny, swarming Patios, near water, in the face Fans, screens, drain standing water

One easy test: set a small vinegar trap with a drop of dish soap. If flies drop in, you have fruit flies. If they ignore it, you probably have fungus gnats, drain flies or phorid flies. For more on fruit flies, see the fruit fly guide.

Why is my house full of gnats all of a sudden?

A sudden swarm almost always means one hidden breeding spot has just produced a big hatch. The cause is usually something you forgot, not something dirty. A single bag of old potatoes, a wet plant or a slow leak can send out hundreds of flies in a few days.

Forgotten produce attracting small flies in a kitchen
Seven places a sudden swarm comes from.

Check them in this order:

  • Produce. Look behind the pantry shelf and under the sink for potatoes, onions and fruit.
  • Plants. Tap a pot. If tiny flies lift off the soil, that is your source.
  • Drains and traps. A guest bathroom or basement floor drain that is rarely used can dry out and breed flies.
  • Leaks. Damp wood or drywall under a sink, behind a toilet or under a floor drain can breed phorid flies.
  • Appliances. Check the dishwasher filter and the tray under the refrigerator.
  • Pet food, compost and bins. Wet food left out and unwashed bins grow flies fast.
  • Outdoors. If the flies are on the window glass and nothing indoors is wet, they may be coming in through loose screens.

A flashlight after dark helps. Many of these flies gather near the source at night.

How do you get rid of gnats on plants?

Dry the soil, trap the adults and treat the larvae. Fungus gnat larvae live in the top inch or two of damp potting mix and feed on fungus and rotting roots. Adults are weak fliers that lay eggs on the surface. You need to hit both stages at once, which is why one fix alone rarely works.

Potted plant with dry top soil and a yellow sticky card
Hit adults and larvae at the same time.

Let the soil dry out

This is the single most effective step. Wait until the top one to two inches of soil is dry before you water again, and empty any water that collects in the saucer. Watering from below keeps the roots moist while the surface stays dry, so the adults have nowhere damp to lay eggs. A pot that feels light when you lift it is ready for water.

Use yellow sticky cards

Press a few yellow cards into the soil on small stakes. They catch adults, which stops new eggs, and they tell you how bad the problem is. They do not touch the larvae in the soil, so they work as a helper and not a cure.

Drench with Bti

Bti is a bacterium that kills fungus gnat larvae when it is mixed into water and poured on the soil. It is sold as mosquito dunks, mosquito bits and some gnat-specific products. It does not affect eggs, pupae or adults, so extension advice is to repeat the drench about every five to seven days. Follow the label for the amount. Many growers soak the dunk or bits in water first and strain it, because sprinkling dry bits on wet soil can grow mold.

Try beneficial nematodes

Nematodes are tiny worms that hunt larvae in the soil. The species most often recommended for fungus gnats is Steinernema feltiae. You mix them into water and pour them on the soil, and they need moist soil to move. They suit people who want to avoid anything chemical, but they cost more and have to be kept fresh.

What about hydrogen peroxide, sand and other fixes?

Fix How it works Verdict
Hydrogen peroxide drench One part 3% peroxide to four parts water, poured on the soil Kills larvae on contact. No trial data, no lasting effect, repeat as needed
Coarse sand or fine grit on top Keeps the surface drier so eggs are less likely to be laid Helps. Decorative pebbles can trap moisture instead
Diatomaceous earth Dries out larvae Only works while dry, so it fails as soon as you water
Cinnamon on the soil May slow fungus growth No reliable evidence that it kills gnats
Neem or soap sprays Contact killers for adults Short-lived and need repeats
Systemic soil insecticide Plant absorbs it Last resort. Check the label for edible plants, pets and children
Repotting in fresh mix Removes the larvae and wet soil Worth it for a severe case or heavy, soggy mix

A potato slice is a handy test. Lay a thick slice flat on the soil. Larvae come up to feed on it, and you can check it after three or four days to see whether larvae are still present.

How long does it take to get rid of gnats on plants?

Plan for about three to four weeks, and longer for a bad case. A fungus gnat takes roughly three to four weeks to go from egg to adult in a warm room. Eggs hatch in a couple of days, larvae feed for about two weeks, and the pupa stage lasts a few more days. That is why a treatment that kills adults today has no effect on the eggs that are already in the soil.

Fungus gnats on damp potting soil
A fungus gnat needs about three to four weeks to grow up.
Houseplant with yellow sticky cards in every pot
A four-week plan for plant gnats.

Do not stop early. Many people see no flies for two days, quit treating, and then watch a new batch hatch a week later.

Why do plant gnats keep coming back?

New plants, new potting mix and wet soil bring them back. A single new plant can carry larvae, and a fresh bag of soil that sat damp in a store can too. Keep new plants away from your collection for several weeks, store bags of soil dry and sealed, and water by weight and feel, not by calendar. Heavy, peaty mixes with wood chunks stay wet longest, so a looser mix with perlite or coir drains better.

How do you get rid of gnats in drains?

Scrub the pipe, then clean it with an enzyme or bio gel. Drain flies and phorid flies lay eggs in the slimy film that coats the inside of drains and traps. Pests that live there survive hot water, bleach and ordinary cleaners, so the film has to be physically removed or digested.

Bathroom sink with its stopper and overflow hole
Four places drain flies breed in a sink.
  1. Pull the stopper. Clean the stopper and the flange with a small brush. These collect hair and soap scum.
  2. Brush the pipe. Use a long, flexible drain brush on the first foot or so of the pipe.
  3. Clean the overflow hole. The little hole near the rim of a bathroom sink can hold a hidden film. A bottle brush or a foam enzyme cleaner reaches it.
  4. Use an enzyme gel overnight. These cling to the pipe wall and digest the film. Many need an hour or more with no water running, so use them before bed.
  5. Refill dry traps. In a basement or guest bathroom drain, pour in a gallon or so of water. Some plumbers suggest a splash of mineral oil on top to slow evaporation.
  6. Repeat for a week. Larvae and eggs that survive the first round hatch later.

Bleach in a bucket does not fix a floor drain with flies. It flows past the film instead of removing it. Baking soda and vinegar fizz, but they neutralize each other and do not strip the film either.

Is boiling water safe for drains?

Use very hot tap water instead of boiling water if your pipes are PVC. Many plumbing sources put the heat limit for PVC at around 140°F, well below boiling. Some plumbers say the risk is small for a quick pour into a free-flowing drain, but boiling water rarely clears the film, so there is little to gain. Never pour it into a slow or clogged drain, or onto a cold or porcelain fixture.

What if the flies are phorid flies?

Phorid flies often point to a wet, rotting spot that is not a drain: a leak behind a wall, a damp floor under a toilet, or a crack in a sewer line. They are small, humpbacked and run in quick dashes across surfaces. If drains are clean and the flies persist, ask a plumber to check for a leak or a damaged sewer line.

How do you get rid of gnats and fruit flies naturally?

Remove what they breed in, then trap the adults. Natural control is mostly cleaning and drying, which is also what works best. You do not need a chemical for most house gnats.

Problem Natural fix
Fruit flies Clear ripe fruit and wet trash, set a vinegar and dish soap trap
Fungus gnats Let the soil dry, yellow sticky cards, Bti, nematodes
Drain flies Brush the pipe, enzyme gel
Flies in the air right now Vacuum them up, or spray them with soapy water
Outdoor swarms A fan on the patio, fine screens, no standing water

How do you get rid of gnats overnight?

You cannot end an infestation in one night, but you can start the right fix tonight. A trap can catch a lot of adults by morning, and sticky cards can pick up plant gnats around the clock. The breeding spot decides how fast it ends.

Tonight:

  • Put yellow sticky cards in every pot.
  • Set a vinegar and dish soap trap near the fruit bowl or sink, to see if they are fruit flies.
  • Let the top of plant soil dry and empty saucers.
  • Pour an enzyme gel into the drain before bed, if you have drain flies.
  • Vacuum the flies you can see, and empty the vacuum outside.

A quick vacuum or a soapy-water spray clears the room in minutes. It does not touch the larvae, so expect more flies to appear in the days after.

Does gnat spray work?

Sprays kill the adults they touch and little else. A spray labeled for flying insects knocks down gnats in the air for a short time, but the larvae in the soil or the drain keep producing more. Extension advice for plants is that contact sprays such as pyrethrins, soaps, oils and neem give poor long-term control and need repeat use.

Use spray only as a backup, and:

  • Follow the label, and keep it off food and prep surfaces.
  • Keep pets, fish tanks and birds out of the room, and cover aquariums as the label directs.
  • Ventilate the room, and do not spray into a drain and expect it to clean the pipe.
  • Go back to the real fix: soil, drain or food.

What is the best gnat killer for indoors?

The best gnat killer is the one aimed at the right stage and the right fly. A single product does not cover all of them.

Gnat Best killer Notes
Fungus gnat larvae Bti drench or nematodes Repeat about every 5 to 7 days
Fungus gnat adults Yellow sticky cards Cheap and effective for adults
Drain fly and phorid larvae Enzyme or bio drain gel Use after brushing
Fruit flies Vinegar and soap trap, or a fruit fly trap Clear the source first
Any adults in a room Vacuum, or a short-term spray Temporary only

Sticky cards usually cost around $8 to $15 for a multipack, Bti dunks or bits around $10 to $25, and drain gels around $10 to $40. These are rough shelf prices and vary by store.

Does Dawn and vinegar get rid of gnats?

Only fruit flies. A bowl of apple cider vinegar with a drop of dish soap attracts and drowns fruit flies, but fungus gnats, drain flies and phorid flies ignore it. It also kills only adults, so it never stops the larvae.

If you do not have apple cider vinegar, a splash of red wine, a little stale beer or a piece of overripe banana with a drop of dish soap works for fruit flies. If the flies ignore every sweet bait, stop trying new baits and re-check which fly you have.

How do you get rid of gnats outside?

Move the air, keep out the swarm and remove standing water. Outdoor gnats include biting midges, eye gnats and non-biting midges. They are small, weak fliers that gather in calm weather, often in the evening.

  • Use a fan. A box fan or a ceiling fan on a porch blows them off course.
  • Fit fine screens. Very fine mesh, around 20 by 20, keeps out biting midges. A standard 18 by 16 screen is usually enough for eye gnats.
  • Drain standing water. Empty buckets, clean gutters and keep ponds and birdbaths moving or treated with Bti.
  • Cover up. A hat with a fine head net helps when you work in a swarm.
  • Do not expect much from repellent. Many repellents work only partly on biting midges.
  • Try warm-toned outdoor bulbs. Some pest guides suggest bug-light bulbs to draw fewer insects at night.

Large outdoor swarms are tough to control around a whole yard. Treat it as managing your own patio or porch, not wiping the swarm out.

Are gnat treatments safe around pets, kids and fish?

Bti and enzyme gels are generally considered safe around people and pets when used as directed, but follow the label. Bti targets fly and mosquito larvae, which is why it is sold for ponds and soil. Sprays and plant-oil aerosols need more care, and an aquarium should be covered before you spray the room.

  • Use drain gels in a closed system, and keep containers out of reach.
  • Keep sprays off food, pet bowls and plants that you eat.
  • Do not use a systemic soil insecticide on herbs, vegetables or plants that pets chew without checking the label.
  • If a pet or child swallows a product, call poison control or your vet right away.

Why do gnats keep coming back?

Because a breeding source is still there. Gnats return when the soil stays wet, the drain film is still in the pipe, or a new plant or bag of soil brings in more. Other common reasons:

  • Wrong trap. A vinegar trap for fungus gnats catches nothing.
  • Only adults were treated. Sticky cards and sprays leave the larvae alive.
  • Treatment stopped too soon. Bti has to be repeated through at least one full life cycle.
  • A hidden source. A leak, a dry trap, a dishwasher filter or an old bag of produce keeps the cycle going.
  • Moisture traps. Pebbles over wet soil keep it damp.

When should you call a pro or a plumber?

Call a plumber for repeat drain or phorid flies after the drains are clean, and a pest pro for swarms in several rooms. A plumber can camera-check for a leaking or cracked sewer line and fix wet rot. A pest company can find hidden sources you have missed. Plant gnats and kitchen fruit flies rarely need a pro.

Quick answers to common questions

How do you get rid of gnats fast?

Find the source, then use sticky cards and traps for adults tonight. Dry the soil, scrub the drain or throw out the rotting food. Expect days to weeks, not hours.

Does Dawn and vinegar get rid of gnats?

It catches fruit flies only. Fungus gnats, drain flies and phorid flies ignore it.

How do you get rid of gnats on plants?

Let the top of the soil dry, add yellow sticky cards and drench with Bti every five to seven days for three to four weeks.

Why is my house full of gnats all of a sudden?

A hidden breeding spot has hatched a big batch. Check forgotten produce, wet plants, drains, leaks, appliance trays and pet food.

What is the best gnat killer for indoors?

Bti for plant larvae, sticky cards for adults, an enzyme gel for drains and a vinegar trap for fruit flies. No single product covers every gnat.

Keep reading: drain fly larvae, the fruit fly guide, the ant guide and more pest control guides.

Is it hard to get rid of gnats for good?

Not once you know which gnat you have. To get rid of gnats for good, keep soil dry, keep drains clean, clear food and moisture, and finish the full three to four weeks of treatment. If flies stay after that, look for a leak or a hidden source before you buy another trap or spray.

Keep reading