Gnats come from eggs laid by adult females in moist organic material, and the adults you see indoors almost always developed inside your own home or just outside its doors. The most common indoor species, fungus gnats, breed in the wet soil of potted plants. Others arrive through window screens, on produce, or from drains and mulch. So the gnats circling your lamp are usually not a random swarm from the yard; they are the local offspring of a small resident population.
That answer matters because it reframes the problem. If gnats appear from nowhere each evening, you cannot fix the source. If they are completing a life cycle inside your space, you can interrupt it at a specific, findable point. Identifying which species is reproducing, and where its larvae are feeding, turns a vague annoyance into a solvable puzzle. This explainer walks through the mechanism, the numbers, the common mistakes, and the practical steps that actually break the cycle.
The breeding cycle, in four stages
Fungus gnats, the familiar small dark flies near houseplants, follow a complete metamorphosis: egg, larva, pupa, adult. Adults live about one week and do little except mate and lay eggs. Each female can deposit roughly 100 to 150 eggs, usually in the top inch of moist soil near plant stems. The eggs hatch in about four to six days.
The larvae are the real engine of the population. These tiny, translucent worms with black heads feed on fungi, decaying plant matter, and fine root hairs in damp soil. Over roughly two weeks they molt through four larval stages, then pupate for about four to six days. The adult that emerges is a weak flyer that stays near the soil, which is why you see them hovering over plants rather than crossing the room.
The rhythm explains the frustrating persistence. A single generation takes roughly three to four weeks at room temperature, and generations overlap continuously in a heated home. Adults live only days, so an ongoing supply of larvae is the only way the swarm sustains itself. Kill the soil-dwelling stages, and the visible adults vanish within about a week. That is the single most important insight for control.
Why damp soil becomes a nursery
Fungus gnat larvae need three conditions together: moisture, food, and warmth. The moisture threshold is the lever. Soil that stays persistently wet at the surface keeps fungal growth active and keeps larvae feeding. Soil that dries between waterings interrupts both the fungi and the larvae, which cannot survive prolonged dryness.
Commercial potting mixes amplify the problem. Modern peat- and coir-based substrates hold water well, and many contain organic material that supports the fungi gnat larvae eat. Overwatering, poor drainage, and pots without functional drainage holes create the permanent damp zone the insects require. A saucer of standing water under a pot adds another reservoir.
Temperature sets the clock. Development runs fastest in the low-to-mid 70s Fahrenheit and slows in cooler rooms, which is why infestations often surge in late winter and spring as homes stay warm and plants get watered more. The counterintuitive detail: a sudden flush of adults is often not a new arrival but a synchronized hatch from larvae that have been developing quietly for two weeks. The population was already there; you only noticed the adults.
A gallery of gnat species, and where each originates
Not every small flying insect is a fungus gnat, and the source differs by species. Blowing a single control strategy across all of them wastes effort. The table compares the common offenders and their true points of origin.
| Common type | Where it breeds | How it reaches you | Usual indoor source |
|---|---|---|---|
| Fungus gnat | Moist potting soil, seedlings, mulch | Eggs laid in soil; hitchhikes on plants | Houseplant pots, greenhouse plants |
| Drain fly (moth fly) | Organic film in drains, traps, sewers | Existing drain biofilms; rarely travels far | Bathroom and kitchen drains |
| Phorid fly | Decaying organic matter, wet trash | Flies in from outside or breeds indoors | Overwatered plants, wet compost, damp garbage |
| Fruit fly | Fermenting fruit, ripe produce, spills | Rides in on produce; breeds indoors | Kitchen fruit, recycling bins, sticky residues |
| Fungus gnat outdoors | Wet leaf litter, mulch beds, compost | Enters through screens and door gaps | Landscape mulch and compost near entries |
The practical takeaway is diagnostic. Gnats hovering around a lamp near your plants are almost certainly fungus gnats breeding in the pots. Small flies rising from a sink or floor drain are drain flies, and their larvae live in the slimy biofilm that coats pipe walls. Flies around a fruit bowl or recycling bin point to fermentation, not soil. Match the species to the source before you act.
Where the "from nowhere" impression comes from
The sensation that gnats materialize overnight has several real causes. Adults are tiny, weak-flying, and drawn to light, so they gather at windows and lamps where you notice them. They can slip through ordinary window screening and gaps around doors, meaning outdoor populations in mulch and leaf litter constantly test your perimeter. A single fertilized female that gets inside can seed an entire indoor generation.
New plants carry the problem in. A nursery pot that looks clean can hold eggs or larvae in its soil, and a newly purchased plant can introduce a breeding population that emerges days after you bring it home. Bagged potting soil is another route, because it can contain eggs and larvae when the bag is opened and stored damp. Compost and outdoor mulch are reservoirs that sit against exterior walls and doorways.
The counterintuitive professional caveat: an indoor gnat problem is usually a moisture-management problem wearing a pest costume. Eradicating adults with sprays feels productive because you see fewer flies for a day, but adults live only about a week anyway. If the soil stays wet, new adults replace them on schedule. The population is governed by larval habitat, not by the adults on your ceiling.
Misconceptions that keep infestations alive
Several widely repeated ideas are wrong enough to sabotage control. The first is that gnats bite. Fungus gnats do not bite humans; they lack biting mouthparts. The small flies that bite are typically biting midges or mosquitoes, and they breed in very different places. Treating your houseplants will not solve a biting-insect problem.
The second is that sticky traps or bug zappers eliminate an infestation. Adhesive stakes catch adults and are genuinely useful for monitoring, because they show whether the population is rising or falling. But they do not touch the eggs, larvae, or pupae in the soil, which are the population's future. Traps measure the problem; they do not end it.
The third is that soil can be sterilized by letting it dry completely and then resuming normal watering. Drying helps, but larvae can persist in protected pockets, and resuming heavy watering restarts the cycle within days. A partial intervention produces a partial, temporary drop that feels like failure and encourages people to escalate to harsher measures too early.
The fourth is that all small flies around plants are the same pest. Drain flies, phorid flies, and fruit flies demand different interventions. Spraying soil for a drain-breeding population wastes weeks.
Practical steps that break the cycle
Let the top inch of soil dry between waterings, and confirm with a finger or a moisture meter before watering again. This single change removes the larval habitat. Repot heavily infested plants into fresh, well-draining mix, and discard the old soil outside, not into another indoor container. Improve drainage: use pots with open drainage holes, empty saucers after watering, and never let pots sit in standing water. Use yellow sticky stakes near the soil surface to monitor adults and judge whether numbers are falling over one to two weeks. For persistent populations, apply a biological larvicide labeled for fungus gnats, following the product label exactly; these target larvae rather than adults. Clear wet mulch, compost, and leaf litter away from exterior doors and windows, and repair torn screens and door sweeps.
Red-flag warnings: Persistent small flies around drains usually mean a biofilm or sewage issue, not a plant problem; a licensed plumber may be needed. Sudden swarms of biting flies or flies emerging from walls can indicate a larger moisture or sanitation problem worth professional inspection. Do not mix multiple pesticides or apply them in enclosed rooms without ventilation, and never use outdoor products indoors. If a household member has asthma or chemical sensitivity, avoid aerosol sprays and rely on moisture control and traps instead.
These steps work because they target the mechanism, not the symptom. Expect adults to persist for about one week after you fix the soil, because pupae already in the soil will still emerge. Judge success by sticky-trap counts trending down over two to three weeks, not by whether a fly lands on your lamp tonight.
What these measures cannot do
Moisture control and habitat removal reduce indoor populations, but they cannot seal a home against every outdoor insect. Screens, door gaps, and the constant movement of plants and produce mean some re-entry is normal. Outdoor mulch and compost near the foundation will keep producing fungus gnats regardless of indoor efforts, so perimeter management matters as much as indoor soil management.
Biological larvicides are effective but not instant, and their performance depends on correct application and timing relative to the larval stage. They are not a substitute for fixing overwatering, because a treated but saturated pot simply recycles the problem. Product availability and labeling vary by region and change over time, so read current labels rather than relying on older advice.
For most households, gnats are a nuisance and a signal of excess moisture, not a health threat. The honest limit is that this article describes general mechanisms; it cannot diagnose a specific infestation or recommend a particular product schedule for your home. If flies persist after you have corrected watering, drainage, and perimeter sources, a licensed pest control professional can identify the species and locate the breeding site. This is general educational information, not a pest-control prescription or a guarantee of elimination.