How to Get Rid of Gnats, Once and For All

Because they’re gnat welcome in your home!

March 30, 2022
Photo by Bobbi Lin

Gnats are the bane of my existence. They invade my home at least once a year it’s because I left an overripe banana at the bottom of the fruit bowl, didn’t clean out the garbage disposal well enough, or even just brought home a new plant that had them hiding in the soil. Then I'm forced to spend the next few weeks trying to banish them from every nook and cranny of my home.

In the grand scheme of things, gnats are harmless—common fruit flies and fungus gnats don’t bite (though some varieties do), but they always seem to be hovering in your face or flying around your food. If you’re sick of seeing these little bugs all around your home, here are some tried-and-true methods to get rid of them, as well as ways you can prevent them from coming back.

What Are Gnats?

There are a few types of small flies and gnats commonly found in homes, and each one is attracted to different things. If you figure out which kind are plaguing your home, you’ll be able to get rid of them more efficiently.

First, there are fruit flies, which are attracted to overripe or rotting fruits and vegetables, so they're usually hovering around fruit bowls. They also like smelly trash bins and garbage disposals, and open bottles of alcohol. These little brown bugs are more common in the summer, but you might see them during the cold months, too.

Next up are fungus gnats, which I have personally battled many times as a houseplant lover. These obnoxious little flies lay their eggs in wet soil, and they’re commonly found in nurseries, meaning you can easily bring them home without knowing. These gnats are black and tinged with silver, and you’ll typically see them hanging out on the soil of your plants or around the rim of planters. If you give your plant a little shake, they'll start flying out from around the plant.

Finally, there are drain flies, and as their name suggests, these bugs live in drains, sewers, and septic tanks—anywhere you might find stagnant water, as that’s where they lay their eggs. They have larger wings than the other two types of gnats, and their bodies are furry, similar to a moth.

How to Prevent Gnats

It’s not too hard to get rid of gnats, but the tricky part is keeping them from coming back—all it takes is one overripe apple for them to make themselves at home again. In general, the cleaner you keep your home, the less likely you are to have gnats. This means storing food in sealed containers and getting rid of overripe produce. You’ll also want to invest in a tightly covered trash can, and clean out your sink, drains, and garbage disposal regularly.

For fungus gnats in particular, letting your plants dry out in between waterings can help to prevent the bugs from laying eggs. Some people also recommend sprinkling a layer of diatomaceous earth on top of soil to kill them.

If you’re really serious about making your home a no-gnat zone, you may also want to seal cracks and crevices around your doors and windows, repair any ripped window screens, and patch any cracks in your home’s foundations.

5 Ways to Get Rid of Gnats

If you have a gnat infestation and don't have the time or luxury of prevention, there are several ways you can eliminate these flying nuisances—many of which involve simple pantry ingredients. Of course, you’ll also want to figure out what attracted them in the first place and get rid of their source of food to stop them from reproducing.

1. The Classic Apple Cider Vinegar Trap

Apple cider vinegar’s sweet smell is appealing to gnats, so you can use it to make an easy trap—a literal thirst trap, if you will. Pour a few tablespoons of apple cider vinegar into a bowl or jar, then stir in a few drops of dish soap. The bugs will be attracted to the sweet smell, and the sticky soap will prevent them from being able to fly away. Some people also like to mix in a little sugar, as well, to really amp up the sweetness.

2. Lure Them With Ripe Produce

If you’re dealing with fruit flies, you can use their favorite snack against them. Place a piece of overripe produce, like an apple slice or mashed banana, in a bowl and cover it with a plastic wrap. Poke a few small holes in the plastic, and once the flies crawl inside, they won’t be able to get back out.

3. Put Empty Wine Bottles to Good Use

The next time you finish a bottle of red wine, leave it on the counter with dregs in the bottom to help trap gnats. They’ll crawl inside because they’re attracted to the smell and won’t be able to get back out. Some people also like to mix in a few drops of dish soap, but I’ve found the alcohol works pretty well on its own.

4. Flush Drains with Bleach

If fruit or drain flies are hanging out in your pipes, you can use a diluted bleach solution to kill them and any eggs. Mix ½ cup bleach with a gallon of water, then carefully pour it down the drain. Flush with plenty of hot water, and repeat as necessary.

5. When in Doubt, Use Sticky Traps

When I have a particularly bad fungus gnat infestation around my plants, I turn to sticky traps to capture the dozens of bugs flying around. Gnats will get stuck to the yellow sticker—just be prepared to be grossed out by how many you catch.

What are your best methods for keeping bugs at bay? Tell us below!

This post contains products independently chosen (and loved) by our editors and writers. Food52 earns an affiliate commission on qualifying purchases of the products we link to.

Grab your copy

It's here: Our game-changing guide to everyone's favorite room in the house. Your Do-Anything Kitchen gathers the smartest ideas and savviest tricks—from our community, test kitchen, and cooks we love—to help transform your space into its best self.

Grab your copy

See what other Food52 readers are saying.

  • catalinalacruz
  • Shamblen
  • DJHilton
  • X-skier
  • Karen
Freelance writer, product tester & baking enthusiast.


catalinalacruz June 4, 2022
About the suggestion to put diatomaceous earth on the soil to kill gnats. It will kill every other insect that comes in contact with it, including beneficial insects. Not a good idea.
Shamblen May 5, 2022
Nematodes do a great job at ridding fungus gnats from houseplants.
DJHilton April 10, 2022
I rub Vaseline on one side of scrap pieces of thick paper or thin cardboard like you get in junk mail and shake the plant or plants and immediately wave the sticky side of the paper over the plant and the adult flies get stuck in the Vaseline. It may take a few swipes to get them all after the ones that got away the first time have settled back on the plant. Sticky traps are very sticky if you accidentally get the glue on you-Vaseline is sticky enough to catch a gnat-it’s much more user friendly.
To prevent them just water your Néw plants well and after that runs off add a solution of 1 tablespoon of apple cider vinegar to a half gallon of water-the acidity will kill the insect stage in the soil. I do it to every néw plant that I plan on bringing inside to live.
X-skier April 10, 2022
Sorry I was incomplete - my prior comment re: using peroxide is for fungus gnats attacking potted plants.
X-skier April 10, 2022
I've not had direct experience with hydrogen peroxide (1/3) and water (2/3) in a spray bottle, but am getting ready to try it since nothing else had worked for me. The directions are to "shake the mix in a spray bottle, spray the undersides of the leaves and the top of the DRY soil. It may take more than 1 application."
Karen April 10, 2022
Bug zapper worked for me
[email protected] April 9, 2022
I did try the apple cider method last night, epic fail. I guess they like Rosemary better. They are also in my living room flying around the lamp. I really don’t want fly paper around my house. Help, I don’t know what to do. I did see the wine bottle idea, will it work with white wine also? Does it really work?
rainbow G. March 30, 2022
You missed my favorite method! Buy a carnivorous plant (we prefer a pitcher plant) and leave it beside the place where you get flies. For us it is on the window sill above the compost. We get a fly or two during the summer, but mostly just a bigger plant year after year.
Carolyn October 4, 2021
Pour a couple of tablespoons of mineral oil down the drain. Worked for me.
We tried the plastic wrap version. Holes were either too large or too small. Didn’t work. Ended up killing them with a towel (approach slowly then knob quickly). You can get really close. Source was thrown out pineapple pieces.
ciaralli June 4, 2021
Good ideas! Another one that I find very satisfying: cover up all other sources of interest to gnats, but leave one small open bowl with bits of banana peel or other fruit. Let the gnats gather then vacuum them away. It takes only a few goes before they're gone for good.