Your guide to household and yard pests Urgent? When to call a pro
What bug is this?
Fruit Flies & Gnats

How to Get Rid of Gnats

How to get rid of gnats in your house: find the breeding source, trap adults with vinegar or sticky cards, and kill larvae with Bti. Plus what fails and why.

harmlessdoes not biteleaves once you fix the cause updated October 15, 2026
Glass jar trap with vinegar, sugar and dish soap on a kitchen counter, with caught fruit flies floating inside
Step 1
identify: fungus gnat, fruit fly, or drain fly
Step 2
remove the breeding source
Step 3
trap adults for 1–2 weeks
Larvae in soil
Bti soil drench or let soil dry
Time to clear
3–7 days (fruit flies), 2–4 weeks (fungus gnats)
Cost
about $0–$20 DIY

Updated October 15, 2026. We added safety guidance: for each product, how dangerous it is for cats, dogs, kids, pregnancy, fish and birds, how to protect your household, and what to do if someone is exposed.

To get rid of gnats, find and remove what they breed in (wet potting soil, overripe produce, trash residue, or drain slime), then trap the remaining adults for one to three weeks. Sprays alone do not work, because larvae keep hatching from the source after every spray.

The catch is that "gnats" are three different insects, and each one needs a different fix. Spend two minutes identifying yours before buying anything.

Step 1: Figure out which gnat you have

  • Black, slender, around houseplants and windows → fungus gnats. Go to the houseplant plan below.
  • Tan with red eyes, around fruit, trash, sink → fruit flies. See the kitchen plan, or the full fruit fly guide.
  • Gray, fuzzy, moth-shaped, on bathroom walls → drain flies. See the drain plan, or how to get rid of drain flies.
  • Small, humpbacked, running in short bursts → phorid flies, usually from a hidden moisture or sewage source; see "When to call a professional."

Not sure? Put out a vinegar trap and a yellow sticky card side by side for a day. Fruit flies end up in the vinegar, fungus gnats on the card. UC IPM also suggests pushing a few raw potato slices, cut side down, into the soil of suspect pots: after a few days, fungus gnat larvae (clear worms with shiny black heads) gather underneath. More detail is on the main gnats page.

Houseplant gnats (fungus gnats)

Fungus gnat larvae live in the top 2 to 3 inches of soil that stays wet, and a full generation takes about 17 days at 75 °F (UC IPM). No single method hits both larvae and adults, so use several together.

  1. Let the soil dry. Colorado State University calls this the main strategy: let the top 1 to 2 inches dry between waterings. Most houseplants tolerate it easily; the eggs and larvae do not. Empty saucers and cachepots. Bottom watering keeps the surface drier.
  2. Put yellow sticky cards in every affected pot. They catch egg-laying adults and show you whether numbers are dropping. They do nothing for larvae, so they are a tool, not a cure.
  3. Drench the soil with Bti. Products with Bacillus thuringiensis subsp. israelensis (Mosquito Bits, Mosquito Dunks, Gnatrol) kill fly larvae and nothing else. Soak bits in your watering can (houseplant growers commonly use about 2 tablespoons per gallon of lukewarm water for 30 minutes), then water from the top so it reaches the larvae near the surface. UC IPM notes Bti does not persist indoors, so repeat about every 5 days for 3 to 4 weeks, and treat every plant at once. Bt sold for caterpillars does not work on gnats.
  4. Or use beneficial nematodes. Steinernema feltiae, sold as a powder you mix into water, kill larvae within 3 to 4 days according to Colorado State and can keep working for weeks. They are alive and perishable, need moist soil and 60–90 °F, and must be used right away.
  5. Top-dress with sand or fine gravel (about 1/2 inch) so the surface dries fast and females cannot lay eggs.
  6. Repot badly infested plants in fresh, pasteurized mix. Old, broken-down soil holds more water and attracts more gnats.
Yellow sticky card in a houseplant pot with black fungus gnats stuck to it, sand on the soil surface
Sticky cards catch adults; a dry soil surface stops new eggs.

Systemic insecticides for houseplants (such as imidacloprid granules) also kill larvae, but Colorado State notes that since July 2024 many neonicotinoid products there are restricted-use, and UC IPM says insecticides are rarely warranted in homes. Bti, nematodes, and drier soil handle nearly every home infestation. Neem oil sprayed on leaves does little, because the larvae are in the soil, not on the plant.

Kitchen gnats (fruit flies)

  1. Remove every food source. Put ripe fruit in the fridge, toss anything soft, check potato and onion bins, wipe the inside of the trash can lid, rinse recycling.
  2. Clean the sink drain and garbage disposal with a brush and dish soap, including the underside of the rubber splash guard; fruit flies breed there too.
  3. Set two or three vinegar traps. A small jar, 1/2 inch of apple cider vinegar, a teaspoon of sugar, one drop of dish soap. Too much soap masks the smell; one drop is enough. Cover with plastic wrap and poke a few holes, or roll a paper funnel into the mouth.
  4. Keep a trap out for two weeks after the last fly to catch late hatchers.

Bathroom gnats (drain flies)

Bleach or a single kettle of boiling water rarely works because the slime coats the pipe walls. Instead:

  1. Tape a strip of clear tape over the drain overnight. Flies stuck to it confirm the drain is the source. Test the sink overflow and any unused drains too.
  2. Remove the stopper and scrub as deep as you can with a long, stiff pipe brush. Clean the P-trap under the sink if you can take it off.
  3. Pour a biological or enzyme drain gel down the drain at night for a week or more; Washington State University recommends these over insecticides.
  4. Run water in rarely used drains (guest shower, basement floor drain) weekly so traps do not dry out.

What kills gnats, and what does not

WorksWhy
Removing the sourcestops new generations
Vinegar + dish soap trapfruit flies only
Yellow sticky cardsfungus gnats; monitors progress
Bti soil drench, every ~5 dayskills fungus gnat larvae
Beneficial nematodeskill fungus gnat larvae, keep working for weeks
Brushing out drains + enzyme gelremoves drain fly larvae
Does not work wellWhy
Foggers and room sprayslarvae survive; adults return in days (UC IPM advises against indoor fogging)
Bleach or boiling water alone down drainsslips past slime on the pipe walls
Neem or soap sprays on leaveslarvae live in the soil
Cinnamon or matches stuck in soilno reliable evidence
Bug zappers indoorsgnats are not strongly drawn to them
Vinegar traps for fungus gnatsthey are not attracted to vinegar

How dangerous are these products

Most of the gnat plan is close to harmless: Bti and nematodes only affect fly larvae and soil insects. The real risks are the extras people reach for: imidacloprid granules in houseplant soil (a problem for bees and for pets that chew plants), foggers, and bleach down drains. Sticky cards are a hazard only for small animals that can get stuck.

Comparison table

Bti (Mosquito Bits, Dunks, Gnatrol)Active ingredient: Bacillus thuringiensis israelensis
CatsSafe
DogsSafe
Kids, pregnancy, allergiesSafe
keep the bag closed; dust can irritate if inhaled
Fish, birds, rodents, reptilesSafe
safe for fish; affects only fly larvae
Beneficial nematodesActive ingredient: Steinernema feltiae
CatsSafe
DogsSafe
Kids, pregnancy, allergiesSafe
Fish, birds, rodents, reptilesSafe
Yellow sticky cardsActive ingredient: glue, no poison
CatsCaution
can stick to fur and whiskers
DogsCaution
Kids, pregnancy, allergiesSafe
keep out of toddlers' reach
Fish, birds, rodents, reptilesDanger
can trap free-flying birds, lizards and small rodents; keep away from cages
Vinegar traps, enzyme drain gelsActive ingredient: acetic acid, enzymes
CatsSafe
DogsSafe
Kids, pregnancy, allergiesSafe
Fish, birds, rodents, reptilesSafe
Imidacloprid houseplant granulesActive ingredient: imidacloprid
CatsCaution
keep cats from chewing treated plants or digging in the soil
DogsCaution
same
Kids, pregnancy, allergiesCaution
wear gloves; keep pots out of kids' reach
Fish, birds, rodents, reptilesKeep out
toxic to aquatic invertebrates and birds if eaten; very toxic to bees, don't move treated plants outdoors
Hydrogen peroxide soil drenchActive ingredient: hydrogen peroxide
CatsCaution
keep away until absorbed
DogsCaution
Kids, pregnancy, allergiesCaution
irritates eyes and skin
Fish, birds, rodents, reptilesCaution
keep out of tanks
Bleach down drainsActive ingredient: sodium hypochlorite
CatsCaution
DogsCaution
Kids, pregnancy, allergiesKeep out
fumes trigger asthma; never mix with vinegar or ammonia
Fish, birds, rodents, reptilesKeep out
birds sensitive to fumes
FoggersActive ingredient: pyrethrins/pyrethroids
CatsDanger
coat every surface cats lick
DogsKeep out
evacuate
Kids, pregnancy, allergiesKeep out
evacuate; flammable
Fish, birds, rodents, reptilesDanger
deadly to fish, dangerous to birds
Safesafe to stayCautionkeep away during applicationKeep outkeep out until dry and aired outDangerserious danger, don't use around them

Notes

  • Bti and nematodes are the safest pest products in the house. No waiting time, fine around kids, pets and aquariums.
  • Imidacloprid granules: the insecticide moves into the whole plant, including flowers and leaves. Keep treated pots away from cats that nibble plants and never set them outside where bees visit. Check the label for current restrictions in your state.
  • Bleach: only in a ventilated room, and never with vinegar traps or ammonia cleaners nearby; the mix releases toxic gas.
  • Foggers don't fix gnats anyway. If one is used, everyone leaves with pets, tanks are covered and the air pump turned off, and pilot lights are out.

If something goes wrong

  • On skin or in eyes. Wash skin with soap and water; rinse eyes with running water for 15 minutes.
  • Swallowed (granules, peroxide, bleach). Don't induce vomiting. Call Poison Control at 1-800-222-1222.
  • A pet ate treated soil or plant, or got stuck on a card. For a stuck animal, loosen glue with vegetable oil, not by pulling. For poisoning, call your vet or ASPCA Animal Poison Control at (888) 426-4435. See pet-safe pest control.

What people who dealt with it say

The r/houseplants community fights fungus gnats constantly, and its biggest threads agree on a lot:

  • Nematodes are the most upvoted answer, again and again, especially for edible herbs. People who had tried everything else for months reported them working within days to a couple of weeks.
  • Bti works if used right. Growers who failed with mosquito bits often sprinkled them on top or watered from the bottom; those who succeeded soaked the bits, watered from the top, treated every plant on the same day, and kept going for 6 to 8 weeks. One grower with hundreds of plants says a quarter of a mosquito dunk soaked in water treats the whole collection for about a month.
  • A sand layer is a cheap win. Several people put about 2 cm of fine sand on top of the soil and said the gnats died out because adults could not lay eggs or emerge.
  • Hydrogen peroxide and diatomaceous earth have fans, but results are mixed; one person found peroxide damaged new leaves. These are not extension-recommended methods, so test on one plant first.
  • Carnivorous plants help at the edges. Sundews and butterworts catch a lot of adults but do not fix the soil.
  • Check beyond the pots. When plants were already treated, the source turned out to be drains, a forgotten bag of potatoes, or gnats breeding in the dirt of window tracks.
  • It takes weeks. People who stuck to drier soil plus Bti or nematodes plus sticky cards usually reported success in 2 to 6 weeks; those who rotated through one method at a time struggled for months.

How to get rid of gnats outside

Outdoor gnats come from damp soil, compost, mulch, and standing water. Cut back on irrigation, turn compost, clear clogged gutters, and empty buckets and saucers. A box fan on the porch keeps weak fliers away from people. Biting black flies breed in streams that can be miles away; Iowa State University says controlling them is not practical and advises against fogging. Repellent, light clothing, and a hat help more than spraying the yard. See gnat bites.

When to call a professional

If gnats persist after three to four weeks of real source control, the breeding site is probably hidden: a broken drain under the floor, a leaking toilet seal, a leak in a wall, the drip pan under the fridge, or rotting debris in a crawl space. A plumber or pest professional can find it. Renters should ask the landlord for a plumbing inspection rather than another spray. Expect roughly $150 to $300 for an inspection and treatment (approximate, varies by region).

FAQ

What kills gnats instantly?
A household flying-insect spray, a vacuum, or a quick swat kills the adults you see, but more emerge from the source within a day or two. For a lasting result, combine traps with removing or treating what they breed in.
What is a good home remedy for gnats?
For fruit flies, a jar of apple cider vinegar with a drop of dish soap. For fungus gnats, let the soil dry out, use yellow sticky cards, and water with a Bti (mosquito bits) soak. For drain flies, scrub the drain with a pipe brush. Each remedy only works on its own gnat.
How do I get rid of gnats in the house quickly?
Within an hour: throw out soft produce, take out the trash, set two or three vinegar traps, put sticky cards in plant pots, and vacuum adults off windows. Fruit flies drop off in 2 to 4 days if the source is gone; fungus gnats take 2 to 4 weeks because the larvae must finish dying off in the soil.
How do I catch gnats?
Fruit flies go for a vinegar or wine trap; fungus gnats stick to yellow sticky cards; drain flies are caught by clear tape laid sticky side down over the drain overnight. Place traps where you see the most gnats and compare catches to find the source.
Do mosquito bits work on fungus gnats?
Yes. Mosquito bits contain Bti, which kills fly larvae, including fungus gnats, and is not toxic to people, pets, or plants. UC IPM notes it does not persist indoors, so reapply about every 5 days for several weeks. Bt products sold for caterpillars do not work on gnats.
How do I get rid of gnats in the kitchen?
Kitchen gnats are usually fruit flies or drain flies. Refrigerate ripe produce, check potato and onion bins, wash the trash can lid, clean the sink drain and disposal splash guard, then set vinegar traps.
How do I get rid of gnats outside?
Outdoor gnats are hard to control. Cut back irrigation, remove soggy mulch and leaf piles, clear gutters, and use fans on patios since gnats are weak fliers. For biting black flies, wear long sleeves, a hat, and repellent; area spraying rarely helps.

Sources and real-world experience

Built from the expert sources and real discussions below — we read each one. How we research.

  1. UC IPM: Fungus Gnats (Pest Notes)
  2. Colorado State University Extension: Fungus Gnats as Houseplant and Indoor Pests
  3. University of Kentucky Entomology: Fruit Flies (ENTFACT-621)
  4. Washington State University Pestsense: Moth flies (drain flies)
  5. Iowa State University Yard and Garden: Black Flies Reported, Already
  6. Reddit r/houseplants: TRUTH: No single fungus gnat control method attacks adults and larvae simultaneously
  7. Reddit r/houseplants: My Fungus Gnats are Invincible - Please Let Me Know What Worked for You!
  8. Reddit r/houseplants: I am this close to buying a gun and shooting at the fungus gnats
Nothing working? When it is time to call an exterminator