Why are fungus gnats in houseplant soil?
Fungus gnats are in houseplant soil because overwatering makes the potting mix stay constantly wet, which causes fungi to bloom and creates a buffet for gnat larvae to feed on. Alternatively, the potting mix may have arrived already contaminated with eggs or larvae from the manufacturer or store.
What is actually going on
You're watering the pothos on the windowsill, and a little cloud of tiny black flies lifts off the pot like you disturbed something. They drift toward the lamp, bump into your face during the evening news, and somehow there are more of them every week. The fruit bowl is empty. The kitchen is clean. So where are they coming from?
The soil itself. Those flies are fungus gnats, and your houseplant pots are their nursery. Females lay eggs in damp potting mix, the eggs hatch into tiny larvae, and the larvae live in the top layer of soil feeding on fungi and decaying organic matter. The gnats aren't visiting your plants. They're being raised in them.
Here's the part that stings a little: the usual reason this happens is overwatering. Soil that stays constantly wet turns into a miniature forest floor, fungi bloom in that moisture, and fungal growth is the main course for gnat larvae. A plant that gets a generous drink every few days "to be safe" is basically running a buffet with the door propped open. The gnats didn't break in. They were invited.
One exception is worth knowing, because sometimes it genuinely isn't your fault. Potting mix occasionally arrives already contaminated, with eggs or larvae in the bag from the manufacturer or from poor storage at the store. If you repotted recently and gnats appeared within a couple of weeks despite careful watering, that's a real possibility. But if they showed up gradually around plants you've had for ages, look at your watering can first.
How to tell for sure
Before you treat anything, confirm you're dealing with fungus gnats and not one of their lookalikes. The fix for each is different, and the wrong diagnosis wastes weeks.
Adult fungus gnats are small, roughly 1/16 to 1/8 inch long, dark gray or black, and delicate, with long legs and long antennae that give them a miniature mosquito look. Their flight is the giveaway: weak, slow, fluttery, usually low over the soil or drifting toward a window, a screen, or a lamp at night. They're drawn to light, which is why one ends up hovering over your laptop while you're trying to work. Tap the side of a suspect pot and watch. If a few delicate flies lift off the soil surface and wobble away, that's usually your answer.
The larvae settle it if you're willing to look. Scratch back the top inch of soil and you may find tiny, legless, translucent whitish worms with a shiny black head. That black head capsule is the detail that separates them from other pale maggots. They live in the top 2 to 3 inches of soil, which matters later, because anything you do has to reach that zone.
Now the usual mix-ups. Fruit flies are tan rather than black, often have noticeable red eyes, and hang around the fruit bowl, the garbage, or the wine glass, not the fern. Drain flies are fuzzy and moth-like, with broad wings, and they breed in the gunk inside sink and shower drains. Phorid flies have a humpbacked look and a habit of scuttling across counters instead of flying. If your flies are coming from the kitchen bin or the bathroom drain, houseplant soil is not your problem, and drying out the ficus won't change a thing.
One reassurance, because everyone asks: fungus gnats do not bite. They have no biting mouthparts, they don't feed on blood, and they don't carry human diseases. To you they are pure annoyance. Your plants may feel differently, since heavy larval feeding can chew on roots, but a mild infestation is mostly a cosmetic problem with wings.
What usually comes next
So here's the choice in front of you: chase the flies you can see, or deal with the soil where they come from. Deal with the soil. The adults live about a week and barely eat anything. The larvae in the pot are the real population, and swatting adults while ignoring them is bailing a boat with the hole still open.
The single most effective move costs nothing at all: let the top 1 to 2 inches of soil dry out between waterings. Eggs and young larvae are fragile, and when that upper layer dries, they die. Since the larvae crowd near the surface, this one habit collapses most infestations over a few weeks. Empty the saucers under your pots too, because standing water down there keeps everything damp and welcoming. Yes, a few of your plants will be slightly thirstier than they'd like. Most common houseplants handle it fine, and it's a lot kinder than root rot, which is where chronic overwatering was headed anyway.
Fair question: won't the adults just keep laying eggs while you wait them out? A few will, but every new generation needs moist soil to survive, and that's exactly what you're taking away. To watch it working, tuck yellow sticky cards into the pots at soil level. Think of them as traffic counters. They catch the emerging adults and show you whether the underground hatch is slowing down. If the cards keep filling week after week, the soil is still producing, and your drying isn't deep enough yet.
For stubborn cases, the standard next step is a biological larvicide containing Bacillus thuringiensis var. israelensis, usually called Bti, applied as a soil drench according to the product label. It's a naturally occurring bacterium whose toxins go after fly larvae specifically, and it's considered safe around people and pets when used as directed. One thing trips people up at the store: the Bt sold for caterpillars on vegetables is a different strain and does nothing to gnat larvae, so read the label before you buy. Beneficial nematodes applied as a soil drench work on the same principle and are another option.
What I'd skip: foggers and aerosol sprays. They kill the adults flying around that evening, leave the larvae untouched, and coat your living room in pesticide residue for the privilege. And if a plant is badly infested and already going downhill, the honest answer is sometimes to repot it in fresh, well-draining mix, gently shaking the old soil off the roots.
When to get help
For a typical home with a few potted plants, this is a do-it-yourself problem, and patience plus drier soil usually wins within a few weeks. No professional required, no drama.
Call in help when the pattern doesn't fit. If small flies are swarming through the whole house and your plants don't seem to be the source, you may be dealing with drain flies or phorid flies breeding in a hidden moisture problem: a slow plumbing leak, a broken drain line, or damp structural material. That calls for a plumber or a licensed pest control professional who can find the actual breeding site, not more sticky traps and wishful thinking.
Get help for the plant too if it's clearly failing: yellowing leaves, wilting despite wet soil, dropped leaves, stunted growth. Heavy larval feeding damages roots and can spread fungal root rots between pots, and a valuable or struggling plant may need more than home care can give it. And if you ever consider anything stronger than a labeled Bti drench, such as systemic insecticides or restricted-use products, that decision belongs to a licensed applicator.
Most of the time, though, the fix is unglamorous: water less, let the surface dry, hang a yellow card, wait out the life cycle. The gnats were telling you something about your watering habits. Once you listen, they leave.