Fungus Gnats: What Causes Them and How to Get Rid of Them

You water your plant and a little cloud of tiny black flies rises from the soil. In most cases, these are fungus gnats, small flies that breed in damp potting soil. In this guide, you’ll learn what fungus gnats are, why they appear, whether they cause harm and how to get rid of them without harsh chemicals.

Quick answer
To get rid of fungus gnats, let the top 1 to 2 inches of soil dry out between waterings, catch the adults with yellow sticky traps and treat the soil to kill the larvae. The safest soil treatment is Bti, a natural bacterium sold as mosquito bits or dunks that only targets fly larvae.
A top layer of coarse sand or grit and bottom watering also help. Because their life cycle lasts about a month, keep up the routine for at least four weeks, even after you stop seeing flies.

Let’s look at how to identify fungus gnats, why they show up, whether they are harmful and the step-by-step plan to get rid of them for good.

What are fungus gnats?

Fungus gnats are tiny flies, about 1/8 inch long, with dark gray or black bodies, long legs and clear wings. They look like miniature mosquitoes, but they don’t bite.

They are weak fliers, moving in short, erratic hops. That’s why they stay close to the soil, walking on it or hovering around the base of the plant. When you move the pot or water it, several take off at once.

The University of California IPM program explains that fungus gnat larvae live in moist soil and feed on fungi and organic matter. That’s where their name comes from.

Person watering the dark potting soil of a plant in a terracotta pot

Fungus gnats vs. fruit flies vs. whiteflies

Three tiny indoor insects are often confused. Knowing which one you have helps you pick the right treatment.

Insect What it looks like Where you find it
Fungus gnat Black or dark gray, slender body, long legs, weak flight On potting soil and around the base of plants
Fruit fly Tan, red eyes, rounder body Near ripe fruit, compost bins and the sink
Whitefly White, like flying specks of powder Under leaves, flying up when the plant is shaken

If the flies rise from the soil when you water, they are fungus gnats. If they gather around the fruit bowl, they are fruit flies. If they hide under the leaves, they are whiteflies, which need a different approach. See how to handle them in the herb plant pests guide.

What causes fungus gnats in houseplants?

The number one cause is soil that stays wet for too long. Female gnats look for damp soil rich in organic matter to lay their eggs. The longer the soil stays soggy, the more inviting it becomes.

The most common triggers are:

  • Overwatering: watering on a schedule without letting the soil dry.
  • Standing water in the saucer under the pot.
  • Pots without drainage holes or with poor drainage.
  • Potting mix rich in decaying organic matter, such as unfinished compost or peat that stays wet.
  • Low light and poor airflow, which slow drying.
  • New plants or new bags of soil that already contain eggs or larvae.

In other words, fungus gnats are first and foremost a sign that the soil is too wet. If your plant also has yellow or droopy leaves, read about overwatered herbs.

Are fungus gnats harmful?

To people and pets, no. Fungus gnats don’t bite, sting or spread disease. They are mostly a nuisance.

To plants, the risk comes from the larvae, not the adults. Larvae feed mainly on fungi and decaying matter, but in large numbers they also chew fine roots and the base of young seedlings.

  • Healthy, established plants usually cope well.
  • Seedlings, cuttings and sprouting seeds suffer most and can die.
  • Plants with already weak roots, often from overwatering, decline faster.

The Missouri Botanical Garden notes that larvae harm seedlings, cuttings and young plants, and can spread fungal diseases such as root rot.

The fungus gnat life cycle

Understanding the life cycle explains why they seem to never go away. At room temperature, one generation takes about three to four weeks:

  1. Egg: a female lays dozens to hundreds of tiny eggs in moist soil. They hatch in a few days.
  2. Larva: small, translucent, with a shiny black head. It lives in the top couple of inches of soil for about two weeks.
  3. Pupa: a short resting stage in the soil that lasts a few days.
  4. Adult: emerges from the soil, lives about a week and starts laying eggs right away.

That’s why killing only the flying adults doesn’t work. As long as larvae are in the soil, new adults keep emerging. The key is to hit both stages at the same time.

How to check for fungus gnat larvae

There’s a simple, cheap test: the potato test.

  1. Cut a raw potato into slices about 1/2 inch thick.
  2. Lay the slices on the soil surface, cut side down.
  3. Wait anywhere from 4 hours to 2 days.
  4. Flip the slices and look closely.

If you see thin, translucent larvae with black heads on the potato, you have fungus gnats. Throw the slices away. You can repeat the test later to confirm the treatment worked.

How to get rid of fungus gnats: step by step

The best results come from combining several steps. No single trick works alone, because each one targets a different stage of the life cycle.

1. Let the soil dry between waterings

This is the most important and cheapest step. Let the top 1 to 2 inches of soil dry before watering again. Larvae die in dry soil and females stop laying eggs there.

  • Do the finger test before every watering.
  • Empty the saucer about 15 minutes after watering.
  • Make sure the drainage holes aren’t blocked.

Herbs that like evenly moist soil, such as basil and mint, handle this short dry period well. Dry-soil herbs like rosemary and thyme actually prefer it.

2. Use yellow sticky traps

Adult fungus gnats are drawn to the color yellow. Yellow sticky cards, sold at garden centers and online, catch the adults before they lay more eggs.

  • Stick the card into the soil just above the surface, or hang it near the plant.
  • Replace it when it fills up.
  • Use it to monitor progress: if fewer gnats are caught each week, the plan is working.

Traps alone won’t solve the problem, because they don’t reach the larvae. But they are very helpful for breaking the cycle.

Yellow sticky traps in houseplant pots on a windowsill

3. Treat the soil with Bti

Bti (Bacillus thuringiensis israelensis) is a natural bacterium that only affects the larvae of mosquitoes and gnats. It is safe for people, pets, earthworms and plants.

In the US, Bti is easy to find as mosquito bits or mosquito dunks at hardware stores and garden centers. A common method is to soak the product in your watering can and use that water for several weeks, following the label. UC IPM explains that Bti doesn’t persist indoors, so it may need repeat applications about every five days.

4. Replace or cover the top layer of soil

Larvae live in the top inch or two of soil. Removing that layer and covering the surface makes a big difference:

  1. Scrape off the top 1 inch of soil and throw it away in a sealed bag.
  2. Top up with fresh potting mix.
  3. Cover with 1/2 inch of coarse sand, horticultural grit or small gravel.

This top layer dries fast and makes it harder for females to reach damp soil to lay eggs. It is a simple, long-lasting barrier.

5. Water from the bottom

With bottom watering, you set the pot in a tray with 1 to 2 inches of water for 15 to 20 minutes. The soil wicks water up through the holes and the surface stays drier, which discourages gnats.

Then lift the pot out and let it drain well. Don’t leave it sitting in water for hours.

6. Consider beneficial nematodes

Beneficial nematodes (Steinernema feltiae) are microscopic worms that hunt fungus gnat larvae in the soil. They are sold online and at garden centers, mixed into water and poured on the soil. They are safe for people, pets and plants, and work well for large houseplant collections. The University of Minnesota reports that this nematode cut fungus gnat numbers by 85 percent in commercial mushroom houses.

7. In severe cases, repot

If the pot is heavily infested, with constantly soggy soil and a bad smell, repotting is the fastest fix:

  1. Remove the plant and shake off the old soil, away from other plants.
  2. Trim any dark, mushy roots.
  3. Wash the pot with soap and water.
  4. Replant in fresh, well-draining potting mix.

Throw the old soil out in a sealed bag. Don’t reuse it in other pots.

Watering fresh potting mix with perlite in a clear plastic pot

Do home remedies for fungus gnats work?

Some help, others barely do. Here’s what to expect:

Method Does it work? Notes
Apple cider vinegar trap with dish soap Partly Catches some adults, but attracts fruit flies more
Diluted hydrogen peroxide drench Partly Can kill larvae on contact, but doesn’t stop new eggs. Always dilute
Cinnamon on the soil Barely A popular tip with little evidence behind it
Sand or grit top layer Yes A cheap and simple physical barrier
Letting the soil dry Yes The foundation of any treatment

If you use hydrogen peroxide, choose the standard 3% solution and mix 1 part with 4 parts water. Water only when the soil is already a bit dry, and avoid frequent use on very young seedlings.

Avoid chemical insecticides indoors, especially on herbs you plan to eat. In most cases, they aren’t needed.

How long does it take to get rid of fungus gnats?

Usually three to four weeks, the length of one full life cycle. During the first week, you’ll still see adults flying, because they were already in the soil as larvae or pupae.

From the second week on, numbers drop quickly if the soil is drying and the traps are catching adults. Keep going until the traps catch no new gnats for a full week.

How to prevent fungus gnats

  • Water by need, not by the calendar.
  • Never leave water in the saucer.
  • Use pots with holes and fast-draining mix.
  • Top-dress indoor pots with coarse sand or grit.
  • Use finished compost, with no food scraps still breaking down.
  • Store potting mix sealed, so gnats can’t lay eggs in the bag.
  • Quarantine new plants for a week and check the soil before placing them near others.
  • Give plants light and airflow, which help the soil dry.

If a white, cottony layer also appears on the soil, the cause is usually the same: too much moisture. See how to fix white mold on soil.

UC IPM sums it up: because fungus gnats thrive in moist conditions, avoid overwatering houseplants and provide good drainage.

Fungus gnats in indoor herbs

With kitchen herbs, take extra care, because the leaves end up in your food. Stick to non-toxic methods: drying the soil, traps, Bti, nematodes and a sand top layer.

  • Basil and mint: like moist but not soggy soil. Let the surface dry slightly before watering. If your basil is struggling, see why your basil is dying.
  • Rosemary and thyme: rarely get gnats, because they like dry soil. If they do, it’s a sign of overwatering. See how to grow thyme in a pot.
  • Seedlings and seed trays: are the most vulnerable. Use fresh mix and don’t let the tray sit in water.

If you’re setting up an indoor herb garden, the kitchen herb garden guide helps you choose the brightest, best-ventilated spot, which already prevents many of these problems. And in winter, when pots dry more slowly indoors, follow the tips in how to grow herbs in winter.

If your plant has yellowing leaves as well as gnats, both problems usually share the same root cause: roots struggling with too much water. See how to diagnose it in herb leaves turning yellow.

Key takeaways
  • Tiny black flies rising from potting soil are almost always fungus gnats.
  • The main cause is soil that stays wet for too long.
  • They don’t harm people, but larvae can damage seedlings and weak roots.
  • Let the top 1 to 2 inches of soil dry between waterings.
  • Combine yellow sticky traps for adults with Bti or a sand top layer for larvae.
  • Keep it up for at least four weeks, the length of one full life cycle.

Frequently asked questions about fungus gnats

What causes fungus gnats in houseplants?

Soil that stays wet for too long. Fungus gnats lay their eggs in damp potting mix rich in organic matter. Watering less often and emptying the saucer already make a big difference.

Do fungus gnats bite?

No. Fungus gnats don’t bite, sting or spread disease to people or pets. They are a nuisance and, in large numbers, can harm seedlings.

How do I kill fungus gnat larvae in soil?

Let the soil dry between waterings and treat it with Bti, such as mosquito bits, following the label. Replacing the top inch of soil and adding a sand layer also helps.

Does cinnamon get rid of fungus gnats?

Not really. It’s a popular tip, but there is little evidence it works. Drying the soil, yellow sticky traps and Bti give much better results.

Does hydrogen peroxide kill fungus gnats?

It can kill some larvae when diluted, 1 part 3% hydrogen peroxide to 4 parts water. It doesn’t prevent new eggs, so use it together with the other steps.

How long does it take to get rid of fungus gnats?

About three to four weeks, the length of their life cycle. Keep going until your traps catch no new gnats for a full week.

Should I repot a plant with fungus gnats?

Not always. In most cases, drying the soil, using traps and replacing the top layer are enough. Repot only if the soil is soggy, smells bad or is heavily infested.

Can fungus gnats live in dry soil?

Not for long. The larvae need moisture to survive, and females avoid dry soil when laying eggs. That’s why letting the top layer dry out is the most effective step.