How to Get Rid of Gnats in Your Kitchen for Good

Kitchen gnats are almost always one of two pests: fruit flies breeding on ripening produce or drain residue, or fungus gnats coming from overwatered houseplants. The fix depends on which type you’re dealing with, but in both cases you need to eliminate their breeding source first and trap the remaining adults second. Skipping either step means they’ll keep coming back, since a single fruit fly can lay hundreds of eggs that hatch in as few as two days.

Identify Which Gnat You Have

Fruit flies are tan or brownish with red eyes and hover around fruit bowls, trash cans, and sink drains. Fungus gnats are darker, almost black, with longer legs, and you’ll see them crawling on the soil surface of potted plants or flying near windows. This distinction matters because their breeding sites are completely different, and treating the wrong one wastes your time.

A quick test: set a glass of apple cider vinegar on the counter overnight. If it’s full of tiny bodies by morning, you have fruit flies. If the gnats ignore it and cluster near your plants instead, you’re dealing with fungus gnats.

Cut Off the Breeding Source

Traps alone won’t solve a gnat problem. Under warm conditions, fruit flies can go from egg to adult in as little as seven days, so a few survivors will repopulate your kitchen within a week. You have to remove the organic matter they’re laying eggs in.

For fruit flies, that means a thorough sweep of every potential food source. Move bananas, tomatoes, onions, and potatoes into the refrigerator or into sealed containers. Check under the fruit bowl for sticky residue. Wipe down counters where juice or wine has spilled. Take out the trash, then clean the inside of the trash can itself, since decaying residue at the bottom is a common overlooked breeding ground. Don’t forget recycling bins with empty bottles or cans that still have sugary residue inside.

For fungus gnats, the breeding site is wet soil. Let the top one to two inches of soil in your houseplants dry out completely between waterings. Switching to bottom-watering for a few weeks helps keep the soil surface dry and far less attractive for egg-laying. If you can, move affected plants out of the kitchen temporarily.

The Best DIY Trap for Fruit Flies

The classic apple cider vinegar trap works, but the design matters more than you’d expect. Pour about a quarter cup of apple cider vinegar into a jar and add a few drops of liquid dish soap. The vinegar’s fermented smell draws fruit flies in, and the soap breaks the surface tension of the liquid so they can’t land and fly away. Their wings get weighed down and they drown.

The most effective version uses a jar with small holes punched in the lid rather than plastic wrap or a paper cone. In a side-by-side test by The Kitchn, the holes-in-lid design caught at least 50 flies in one week, while plastic wrap and paper cone versions caught fewer than 10 each. The small holes let the scent waft out freely but make it harder for flies to escape once they’re inside. Set out two or three of these jars near your problem areas: by the sink, near the trash can, and close to any fruit storage.

Treat Your Kitchen Drains

If gnats keep appearing even after you’ve removed all exposed food, your sink drain is likely the culprit. A slimy layer of organic buildup coats the inside of kitchen pipes over time, and fruit flies lay eggs directly in it. This biofilm is the reason common quick fixes fall short.

Boiling water flushes loose debris but cools too fast once it hits cold pipes to dissolve the sticky biofilm clinging to the walls. Bleach kills surface bacteria on contact but rinses out before it can penetrate the buildup. Within about three days, the flies are back. Bleach also corrodes metal drains over time, and if you’re on a septic system, it kills the beneficial bacteria your tank depends on.

What actually works is physically removing or breaking down the biofilm. An enzyme-based drain gel uses microorganisms to digest the organic layer where flies breed. These gels are thicker than liquid cleaners, so they cling to pipe walls long enough to do real work. Pour the gel down the drain before bed, let it sit overnight without running water, and repeat for several nights. You can also scrub the visible part of the drain opening with a stiff bottle brush to remove buildup you can reach.

Handle Fungus Gnats in Houseplant Soil

Drying out the soil disrupts the gnats’ life cycle, but if the infestation is established, you can kill larvae directly with a hydrogen peroxide drench. Mix one part standard 3% hydrogen peroxide with four parts water and pour it over the soil until it flows out the drainage holes. You’ll see fizzing as the solution attacks the larvae. Let the soil dry out completely afterward before watering again.

Yellow sticky traps placed near the soil surface catch adult gnats before they can lay more eggs. These are inexpensive cards coated with adhesive that you can stick into the pot on a small stake. They won’t solve the problem alone, but they reduce the adult population while the soil treatment handles the larvae below the surface.

Plug-In Traps for Ongoing Control

If you’d rather not have jars of vinegar on your counter, plug-in UV light traps are a hands-off alternative. These small devices use blue and ultraviolet light to attract flying insects onto a sticky card hidden inside the unit. They look like a nightlight and don’t produce any smell or chemicals.

One popular model caught over 50 fruit flies, plus moths and houseflies, when placed near a kitchen outlet. These traps work well as a second line of defense once you’ve addressed the breeding source. They’re effective in spaces up to about 400 square feet, and replacing the sticky card every few weeks is the only maintenance. They won’t eliminate an active infestation on their own, but they catch stragglers and give you an early warning if a new wave appears.

Preventing Gnats From Coming Back

Once you’ve cleared an infestation, a few habits keep it from returning. Store ripe fruit in the refrigerator or in sealed containers rather than in open bowls. Rinse bottles and cans before putting them in recycling. Take kitchen trash out before it sits overnight, especially in warm months. Wipe down the inside of your trash can with soapy water every couple of weeks.

Keep sink drains running clean by flushing them with an enzyme cleaner once a month, particularly during summer when fruit fly populations peak. For houseplants, avoid overwatering and consider adding a half-inch layer of coarse sand on top of the soil. Sand drains quickly and creates a dry barrier that discourages egg-laying.

Seasonal humidity plays a role too. Gnats thrive in moist environments, and infestations tend to peak in summer and early fall. As indoor air dries out during heating season, most kitchen gnat populations drop off naturally. If you’re fighting gnats year-round, a dehumidifier or better ventilation near problem areas can make your kitchen less hospitable to them.