If you’ve noticed tiny black flies hovering around your houseplants, you’re probably dealing with fungus gnats. These small insects are attracted to damp potting soil, where they lay their eggs. Once the eggs hatch, the larvae feed on fungi and decaying organic matter in the soil. In larger numbers, they may also nibble on delicate plant roots, especially in young or stressed plants.
A single female fungus gnat can lay hundreds of eggs, so what starts as a few annoying flies can quickly become a full infestation. The good news is that they’re fairly easy to control once you interrupt their life cycle.
Here are six effective ways to get rid of fungus gnats and keep them from coming back.

1. Treat the Soil With Hydrogen Peroxide
Hydrogen peroxide is an easy way to kill fungus gnat larvae living beneath the soil surface. Mix one part 3% hydrogen peroxide with three parts water, then water your plant as you normally would.
You may notice some bubbling after you pour it onto the soil. That’s completely normal. The solution helps eliminate larvae while adding oxygen to the soil. Wait until the top layer of soil has dried before repeating the treatment if needed.
Related: Watering Mistakes You Might Be Making (And How to Fix Them)
2. Place Yellow Sticky Traps Near Your Plants
Sticky traps won’t kill the larvae, but they do a great job of catching the adult gnats before they can lay more eggs. Place yellow sticky cards just above the soil or attach them to small stakes in the pot.
As the adult population drops, you’ll notice fewer gnats flying around your plants over the following weeks.
3. Make an Apple Cider Vinegar Trap
Apple cider vinegar is a simple household remedy that attracts adult fungus gnats. Pour two to four tablespoons of apple cider vinegar into a small bowl and add a few drops of dish soap.
Set the bowl near your affected plants. The vinegar attracts the gnats, while the soap breaks the surface tension so they sink instead of flying away.
Related: 10 Reasons Your Lawn Has Brown Spots—and How to Fix Them
4. Sprinkle Cinnamon on the Soil
Ground cinnamon does more than add flavor to baked goods. It also has natural antifungal properties that can reduce the fungi fungus gnat larvae feed on.
Lightly dust the surface of the soil with cinnamon after watering. While it won’t eliminate an infestation on its own, it can work well alongside other treatments.
5. Spray the Soil With Neem Oil
Neem oil is a natural product that’s commonly used to manage many garden pests, including fungus gnats. Mix a few drops of neem oil with water according to the product label and spray the top of the soil and the base of the plant.
Applying it about once a week can help reduce larvae and discourage adult gnats from laying new eggs.
Related: 15 Houseplants That Thrive Even When Neglected
6. Let the Soil Dry Between Waterings
One of the easiest ways to stop fungus gnats is to make the soil less inviting. These insects thrive in consistently moist potting mix, so allow the top inch or two of soil to dry before watering again whenever your plant can tolerate it.
Good drainage is just as important. Empty standing water from saucers after watering, and make sure your pots have drainage holes. Drier soil makes it much harder for fungus gnats to reproduce and helps prevent future infestations.
