Skip to content
Cleaning & Maintenance

How to get rid of gnats in the house, from houseplants to the kitchen

Three flies commonly get called gnats indoors: fungus gnats from damp potting soil, fruit flies from ripe or fermenting food, and drain flies from the slime inside drains. This guide shows you how to tell them apart, find the source and clear it.

By The Homefield Journal Editors Reviewed

A hand testing the dryness of the potting soil in a terracotta pot on a sunny windowsill

Which kind of gnat is in your house?

The word gnat covers several tiny flies, and the three you are most likely to find indoors breed in very different places, so identifying yours comes first. Fungus gnats are dark, delicate flies that look a little like mosquitoes. The University of California Statewide IPM Program puts most adults at about 1/16 to 1/8 inch long, with long segmented antennae and light gray to clear wings. They are attracted to light and often show up near windows first, and they tend to stay close to potted plants.

Fruit flies, also called vinegar or pomace flies, are about 1/8 inch long and usually have red eyes. University of Kentucky entomologist Michael F. Potter describes the front of the body as tan and the rear as black, and notes that small flies or gnats seen in a kitchen are probably fruit flies. They are especially common in late summer and fall, when ripe and fermenting produce draws them.

Drain flies are fuzzy, and University of Maryland Extension describes them as 1/16 to 1/4 inch long, pale brownish gray to black and found mostly in kitchens, bathrooms and basements near floor drains. Their larvae live in the gelatinous film inside drains and traps.

How do you find where the gnats are breeding?

Each of these flies spends its early life as a larva in something moist, and UC IPM notes that the most effective control methods work on those immature stages. University of Maryland Extension suggests covering a suspect plant or drain with screen or cheesecloth and checking it over the next several days for flies. For drains and garbage disposals, the Kentucky fact sheet recommends taping a clear plastic food storage bag over the opening overnight, since any adults emerging from the drain will be caught inside. To check potting soil for fungus gnat larvae, UC IPM describes pressing chunks of raw potato into the soil with the cut side down. After a few days, lift the pieces and look for larvae.

Maryland Extension also lists sewer leaks, dirty garbage cans, saucers under potted plants and the condensate pans under refrigerators and air conditioners as places where drain flies can breed. Kentucky adds empty bottles and cans, trash containers, mops and cleaning rags for fruit flies, and notes that a single forgotten rotting potato or onion can breed thousands.

A hand pushing a wooden skewer topped with a small yellow sticky card into a potted pothos on a kitchen windowsill
UC IPM suggests cutting yellow sticky traps into small squares and setting them in pots on wooden skewers to catch adult fungus gnats.

How do you get rid of fungus gnats in houseplants?

Fungus gnat larvae need constantly moist soil, and Maryland Extension notes that they die when the soil dries out. These steps follow UC IPM and Maryland Extension guidance:

  1. Let the surface of the potting soil dry between waterings so the soil does not stay wet.
  2. Empty standing water from saucers and fix any plumbing leaks near your plants.
  3. Improve drainage in the potting mix, for example by raising the proportion of perlite or sand when you repot.
  4. Cut yellow sticky traps into small squares, attach them to wooden skewers and set them in the pots to catch adults.
  5. Place raw potato chunks in the soil, then remove the infested pieces after a few days and replace them with fresh ones.
  6. Leave infested plants where they are so emerging flies do not reach other pots, and consider discarding a plant that is severely infested.

When you repot, UC IPM recommends using only pasteurized potting mix and avoiding compost that has not fully broken down, because it is often infested with fungus gnats. At 75°F, UC IPM says fungus gnat eggs hatch in about 3 days, larvae take about 10 days to become pupae and adults emerge about 4 days later, so keep these habits up for a few weeks while the larvae already in the soil finish their cycle. For more care advice on indoor plants, browse our flowers and plants section.

How do you get rid of fruit flies in the kitchen?

The Kentucky fact sheet says a female can lay about 500 eggs and that the whole cycle from egg to adult can be completed in about a week. It also warns that spraying the adults leaves the problem in place as long as the breeding sites remain, so the work starts with the food:

  1. Eat, refrigerate or discard produce once it has ripened.
  2. Cut away cracked or damaged parts of fruits and vegetables and throw them out, since eggs or larvae may be in the damaged area.
  3. Check for forgotten potatoes and onions, juice spilled under the refrigerator and recycling bins that are never emptied or cleaned.
  4. Seal containers well if you home-can fruits and vegetables or make wine, cider or beer.
  5. Roll a sheet of notebook paper into a funnel, set it in a jar baited with a few ounces of cider vinegar and place the trap wherever you see flies.

The jar trap catches the adults that remain once the source is gone, and tight-fitting 16-mesh screens on windows and doors help keep more from coming in from outdoors.

A hand holding a glass jar with a paper funnel and a little cider vinegar on a kitchen counter near a fruit bowl
The University of Kentucky fruit fly trap is a jar baited with a few ounces of cider vinegar and fitted with a funnel rolled from notebook paper.

How do you clear gnats out of a drain?

Drain flies, and sometimes fungus gnats, breed in the slime that builds up inside drains and traps. Maryland Extension recommends cleaning traps and drains mechanically or with an over-the-counter drain cleaner followed by hot water. Mechanical cleaning means scrubbing the film out of the drain opening and the trap. If you use a drain cleaner, read the label and follow its directions exactly. Maryland Extension notes that adult drain flies may live up to 2 weeks and that development from egg to adult takes 7 to 28 days, so a few adults may keep appearing for a while after cleaning. Repeat the clear bag test afterward on each drain, including basement floor drains you rarely use, to confirm it has stopped producing flies.

Should you use sprays or soil treatments for gnats?

UC IPM considers insecticides rarely warranted for fungus gnats in and around homes. If drying the soil and trapping are not enough, two biological options act on the larvae. Bacillus thuringiensis subspecies israelensis, usually shortened to Bti, is a naturally occurring bacterium sold in soil drench products, and UC IPM says it is toxic only to fly larvae. Bti does not reproduce or persist indoors, so potted plants may need repeated applications at about five-day intervals. The Bt sold for caterpillars is a different subspecies that is not effective against fly larvae, so check that the label names israelensis. Steinernema feltiae nematodes are the second option, and UC IPM notes that they work when conditions are moist and temperatures are between 60 and 90°F.

If gnat numbers are intolerable and those products are unavailable, UC IPM says pyrethrins or a pyrethroid insecticide can give temporary control when sprayed on the surface of the potting soil and on the plant parts where adults rest. It advises against fogging indoors or spraying gnats in flight, and suggests treating plants outdoors when possible. The Environmental Protection Agency explains that pesticide labels are legally enforceable and that every label states it is a violation of federal law to use the product in a manner inconsistent with its labeling. Choose a product labeled for your use, such as house plants, and follow its directions.

How do you keep gnats from coming back?

Prevention means keeping moisture and decaying material from building up where flies can breed. Water houseplants once the soil surface has dried, empty plant saucers and buy pasteurized potting mix. In the kitchen, refrigerate ripe produce, empty and clean trash and recycling containers, and wipe up juice spills. Clean sink and floor drains regularly and check appliance condensate pans. UC IPM also recommends screening and caulking leaky windows and doors to help keep pests from coming indoors. Adding these tasks to a seasonal home maintenance checklist keeps them on your calendar, and you can find more household routines in our cleaning and maintenance section.

When to call a pro

Signs the source is out of reach

Gnats that keep returning after you have dried the soil, cleaned the drains and removed overripe food may be breeding somewhere you cannot see or reach, and that is the point to bring in a plumber, a licensed pest control company or your county Cooperative Extension office.

  • Flies keep emerging from a drain after cleaning, which can point to a sewer leak or back-up, two places Maryland Extension lists among drain fly breeding sites.
  • Water is leaking from plumbing, a refrigerator or an air conditioner condensate pan.
  • A houseplant keeps wilting when its watering is correct, since UC IPM notes that root decay fungi and poor drainage are common causes of wilting.
  • You are thinking about a pesticide whose label does not cover indoor or house plant use.

Common questions

What is the fastest way to get rid of gnats?

Remove the place where they breed, because the adults keep coming as long as larvae are developing. Dry out the potting soil for fungus gnats, discard or refrigerate ripe produce for fruit flies and clean the drain and trap for drain flies. Yellow sticky traps and a cider vinegar jar trap then catch the adults that remain.

Do fungus gnats hurt houseplants?

Adult fungus gnats do not damage plants, according to UC IPM, and University of Maryland Extension calls them annoying but harmless indoors. Their larvae can damage roots and stunt growth when they are present in large numbers, particularly in seedlings and young plants. UC IPM adds that overwatering, root decay fungi and poor drainage are much more common causes of wilting.

Does apple cider vinegar get rid of gnats?

The cider vinegar jar described by University of Kentucky Entomology is a trap for fruit flies, and it catches the adults left after you remove the produce or spill they were breeding in. For fungus gnats around houseplants, UC IPM and Maryland Extension use yellow sticky traps placed in the pots, together with drier soil.

How long does it take to get rid of gnats?

Plan on at least one full life cycle after you remove the source. UC IPM puts a fungus gnat generation at about 17 days at 75°F, the Kentucky fact sheet says fruit flies can go from egg to adult in about a week, and Maryland Extension gives 7 to 28 days for drain flies.

Sources

Sources checked on November 2, 2026.

  1. Fungus Gnats, UC Statewide IPM Program (University of California) : Identification and size, harmlessness of adults, root damage by larvae, life cycle at 75°F, watering and drainage, pasteurized potting mix, sticky traps on skewers, potato chunks, Bti, Steinernema feltiae, pyrethrins and indoor spraying precautions.
  2. Fungus Gnats, University of Maryland Extension : Screen or cheesecloth test to find the source, yellow sticky traps, drying the soil to kill larvae, Bti soil drench, fungus gnats breeding in drains.
  3. Drain Flies, University of Maryland Extension : Drain fly size and appearance, breeding sites including condensate pans and sewer leaks, adult lifespan and development time, cleaning traps and drains.
  4. ENTFACT-621: Fruit Flies, University of Kentucky Entomology : Fruit fly appearance, egg count and life cycle, breeding sites, prevention, clear bag test over drains, 16-mesh screens and the cider vinegar jar trap.
  5. Fruit Flies, UC Statewide IPM Program (University of California) : Vinegar or pomace flies, their size and red eyes, and sanitation by removing overripe fruit.
  6. Introduction to Pesticide Labels, U.S. Environmental Protection Agency : Pesticide labels are legally enforceable, and using a product inconsistently with its labeling violates federal law.

Keep reading

Cleaning & Maintenance

All in Cleaning & Maintenance