What Attracts Gnats Indoors and Out

By the Pest Control Brief editorial team Published October 13, 2026 11 min read
Kitchen windowsill with potted herbs and a fruit bowl
Quick answer

Gnats are attracted to moisture and decay: fungus gnats to damp potting soil, fruit flies to fermenting fruit, vinegar, beer and juice, and drain flies to the slimy film inside drains. Outdoors, eye gnats are drawn to the eyes, sweat and other secretions, and biting midges home in on the carbon dioxide and odours people give off. Find which gnat you have and remove what drew it, and the gnats usually go.

“Gnat” is not one insect. Kentucky entomologists point out that the word is an umbrella term for many small flies that do not belong to a single insect family, which is why one-size advice so often fails: a vinegar trap that empties a kitchen of fruit flies does nothing for fungus gnats in a fern. This guide is organised around the attractant, because that is what you can change.

What attracts each type of gnat

Gnat Where you see it What attracts it Where it breeds Bites?
Fungus gnat Around houseplants, windows, screens, faces Moist soil, fungi, decaying organic matter; adults to light Damp potting mix, compost, wet mulch No
Fruit fly Kitchen, fruit bowl, bins, drinks Ripe and fermenting produce, vinegar, beer, juice Moist film of fermenting material: produce, bins, drains, mops, empty bottles No
Drain fly Resting on bathroom and kitchen walls Moisture and organic matter Organic film in sink, shower and floor drains No
Eye gnat Outdoors, hovering at eyes, nose, mouth Eye fluid, sweat, skin secretions, wounds Moist sandy soil with fresh organic matter turned in No, but persistent
Biting midge (no-see-um) Outdoors near water, dusk to morning Carbon dioxide and host odours Edges of streams, marshes, ponds, puddles or tree holes, depending on species Yes, females
Non-biting midge Clouds near ponds, lakes, streams Mating swarms near breeding water; lights at night Shallow, stagnant, nutrient-rich water No

The first three are the indoor gnats, and they are covered in more depth, including what professional treatment costs, in our guide to fruit flies, drain flies and gnats. If you are not yet sure which one you have, start with small flying bugs in the house.

Gnats compared by adult body lengthThe indoor gnats overlap at 2 to 4 mm, so size will not tell them apart; where they gather and what they are drawn to will. Biting midges are about 1 mm, small enough to pass ordinary window screen.Biting midge (no-see-um)1 mmEye gnat1.6 to 3.2 mmFungus gnat1.6 to 3.2 mmDrain fly2 to 4 mmFruit fly3 mmPhorid fly3 mmNon-biting midge6.4 to 12.7 mm024681012mm
Gnats compared by adult body length The indoor gnats overlap at 2 to 4 mm, so size will not tell them apart; where they gather and what they are drawn to will. Biting midges are about 1 mm, small enough to pass ordinary window screen. Source: UC IPM Pest Notes; University of Kentucky ENTFACT-632 and 657; UF/IFAS EENY-349.
Overwatered potted plant with wet soil
Fungus gnats breed in constantly wet potting soil. Illustration for The Pest Control Brief.

What attracts gnats in the house

Fungus gnats: wet soil

UC IPM puts it simply: fungus gnats “thrive in moist conditions, especially where there is an abundance of decaying vegetation and fungi.” Females lay eggs in moist organic debris or potting soil, and the larvae feed on fungi, organic matter and root hairs. Kentucky’s small-fly fact sheet adds that females lay 100 to 200 eggs on moist soil or near plant stems.

The less obvious attractants are what you add to a pot. UC IPM warns that incompletely composted organic matter in potting media “will often be infested with fungus gnats,” and that moist grass clippings, compost, organic fertilisers and mulches are favourite breeding spots. It also advises against heavy use of manure, blood meal and similar organic materials. A new bag of potting mix stored open on the ground can become infested before you use it.

Fungus gnat life cycle at 75°FAt 75°F a fungus gnat goes from egg to adult in about 17 days, so overwatered pots produce a new generation roughly every two and a half weeks. Adults live 7 to 10 days.Egg3 dayslaid in damp potting soilLarva10 daysfeeds on fungi, organic matter, root hairsPupa4 daysin the soilAdult7 to 10 daysshort-lived; weak flier, drawn to light0246810All stages together: 24 to 27 days
Fungus gnat life cycle at 75°F At 75°F a fungus gnat goes from egg to adult in about 17 days, so overwatered pots produce a new generation roughly every two and a half weeks. Adults live 7 to 10 days. Source: UC IPM Pest Notes: Fungus Gnats (7448); University of Kentucky ENTFACT-657.

At 75°F, UC IPM gives about 3 days for eggs to hatch, about 10 days as a larva and about 4 as a pupa, so a new generation every 17 days or so. That is why watering on a fixed schedule, whether the soil is dry or not, keeps a problem going. Our houseplant pests guide covers the watering routine that breaks it.

Fruit flies: fermentation

Fruit flies follow fermentation. Kentucky entomologist Michael Potter writes that they are “attracted to ripened or fermenting fruits and vegetables,” and Kentucky’s newer small-flies fact sheet adds “fermented foods such as vinegar, beer, and various juices.” The attractant does not have to be fruit: they also breed in drains, garbage disposals, empty bottles and cans, trash containers, mops and cleaning rags, because “all that is needed for development is a moist film of fermenting material.”

Two attractants are easy to miss. Home canning, wine, cider and beer containers that are not well sealed let fruit flies lay eggs under the lid. And, per Potter, “a single rotting potato or onion forgotten at the back of a closet, or fruit juice spillage under a refrigerator can breed thousands of fruit flies.” Adults can also come in through screens that are not tight; Kentucky recommends 16-mesh.

Drain flies: the film in the pipe

Drain flies are attracted to moisture and organic matter, and Kentucky notes the females lay clusters of 10 to 100 eggs in the organic matter that builds up in sink and shower drains, as well as in animal waste and sewage. The larvae feed on decaying matter, bacteria, mould, algae and protozoa in standing water. The fix is physical: Kentucky says to use a brush to remove the organic film. Our guide to bugs in the kitchen sink walks through checking each drain.

Why are gnats attracted to my face?

It depends which gnat, and the answer is different indoors and out.

  • Indoors, it is usually fungus gnats. Kentucky notes they “are usually reported flying around people’s faces and computer screens,” and both Kentucky and UC IPM say the adults are drawn to light. They do not bite and are not feeding on you; they are weak fliers that stay close to plants, screens and windows, which is often exactly where your face is.
  • Outdoors, eye gnats want your secretions. UC IPM explains that adult female eye gnats feed on “animal sweat, sebaceous secretions, pus, or blood” to get protein for egg production. They cannot bite, but they crawl over skin and feed at the eyes, nose and mouth, using spurs on their hind legs to scrape the skin and increase the flow. UC IPM adds that they are “very persistent, so brushing them away is ineffective.” Males do not feed this way.
  • Biting midges follow your breath. Carbon dioxide and 1-octen-3-ol are host odours that mammals emit, and traps baited with them have been used against biting midges, according to a 2017 study in the Journal of Chemical Ecology. Our no-see-ums guide covers the bites.
  • Midge clouds are mating swarms. Kentucky describes large swarms of males near breeding water that “may be walked in or driven through,” leaving insects on skin, in hair and on faces. These midges do not bite, and Kentucky says the swarm “is temporary and often dissipates in a day or two.”

Outdoor attractants overlap with mosquitoes, which use some of the same cues; see what attracts mosquitoes.

Bowl of ripe bananas and peaches on a counter
Fermenting fruit attracts fruit flies. Illustration for The Pest Control Brief.

Turning the attractant into a trap

Because each gnat responds to something different, the trap has to match. These are the methods extension entomologists describe:

Gnat Trap or bait How Source
Fruit fly Cider vinegar jar A few ounces of cider vinegar in a jar with a paper funnel, or vinegar plus a drop of dish soap University of Kentucky
Fungus gnat adults Yellow sticky trap Cut into small squares on skewers and set in pots UC IPM
Fungus gnat larvae Raw potato chunks Cut side down in the soil; remove and replace after a few days UC IPM
Fruit or drain flies in a drain Clear plastic bag Tape over the drain overnight; emerging adults are caught University of Kentucky
Eye gnat Egg-bait bottle trap Four eggs mixed into a gallon of water in a 2-litre bottle with side holes, hung 2 to 3 feet up, away from doors; refresh every 14 days UC IPM

Traps catch adults; they do not remove the source. Kentucky’s guidance on fruit flies applies to all of these: unless breeding sites are removed or cleaned, “the problem will continue no matter how often insecticides are applied to control the adults.”

When gnats show up: our data

We analysed US iNaturalist research-grade records to see when each gnat is recorded. The chart shows each group’s share of all records by month, scaled so its yearly average is 100, which removes the summer surge in how many people are out recording.

When gnats are recorded in the US, by monthSeasonality index: each month's share of all US iNaturalist research-grade records, scaled so the yearly mean is 100. Fruit flies surge in October and November, drain flies peak in October; biting midges have only 309 records, so their curve is rough.JFMAMJJASONDFruit fliespeaks in NovemberDrain fliespeaks in OctoberBiting midgespeaks in June
When gnats are recorded in the US, by month Seasonality index: each month's share of all US iNaturalist research-grade records, scaled so the yearly mean is 100. Fruit flies surge in October and November, drain flies peak in October; biting midges have only 309 records, so their curve is rough. Source: The Pest Control Brief analysis of iNaturalist research-grade records, pulled October 2026.

Fruit flies climb sharply in autumn, from 94 in August to 220 in October and 269 in November, matching Kentucky’s note that they are “especially common during late summer/fall” when garden produce comes indoors. Drain flies run above their usual share from August to November, peaking at 156 in October. Biting midge records cluster from June to October, but this group has only 309 records in total, so treat its monthly shape as rough. Fungus gnats had too few records to chart. These are records of insects people photographed and identified, not counts of infestations.

Bathroom sink drain close view
Drain flies breed in the film inside drains. Illustration for The Pest Control Brief.

What attracts gnats outside

Outdoors the attractants are moisture and organic matter on a larger scale. UC IPM says eye gnats breed in moist, well-drained sandy soils with abundant organic matter and are “attracted to, and reproduce in, fresh organic matter turned into the soil,” so it advises reducing the organic matter worked into soils and flowerbeds and keeping the soil surface drier. Eye gnats tend to fly close to the ground: research cited by UC IPM found an 8-foot screen fence or barrier excluded more than 90 per cent of them. Non-biting midges come from shallow, stagnant, nutrient-rich water, so Kentucky suggests eliminating wet areas and standing water. At night, Kentucky notes, adult gnats and midges are attracted to outdoor lights, particularly mercury vapour lamps; motion-activated lighting or bulbs with yellow, orange or pink tints are less attractive. For flies around patios more generally, see how to get rid of flies outside.

How to get rid of gnats in the house quickly

  1. Identify the gnat from where it gathers: soil and windows (fungus gnat), fruit and bins (fruit fly), drain walls (drain fly).
  2. Remove the attractant the same day. Refrigerate or discard ripe produce, empty and rinse bins and recycling, clean up juice spills, brush out drains.
  3. Let potting soil dry between waterings, as UC IPM advises, empty saucers, and improve drainage. Discard badly infested plants or soil if needed.
  4. Trap the adults with the matching trap above, which also tells you whether the source is gone.
  5. Use biological or chemical products only as a back-up. UC IPM says insecticides “generally aren’t recommended for fungus gnat management in and around the home,” and lists Bti, a bacterial product that works on larvae in potting media, among the options; it may need repeating about every five days. Kentucky says a pyrethrum aerosol may be used on remaining fruit flies once the source is gone. Follow the label.
  6. Call a plumber or pest professional if flies keep appearing with no source you can find, especially near floor drains or on a ground floor. Our guide to flies in the house all of a sudden covers hidden sources.

Frequently asked questions

What is the fastest way to get rid of gnats?

Remove what is attracting and breeding them, then trap the adults that are left. For fruit flies, that means discarding or refrigerating ripe produce and cleaning bins, then setting a cider vinegar jar trap. For fungus gnats, let the soil dry and use yellow sticky traps. For drain flies, scrub the film out of the drain with a brush. Kentucky entomologists stress that sprays alone do not work while the source remains.

Why do I have gnats all of a sudden?

Usually something new is feeding them. Fruit flies often arrive on produce that was already infested, and Kentucky notes they are especially common in late summer and autumn. Fungus gnats often follow a change in watering, a new plant, or potting mix containing incompletely composted material, which UC IPM says is often infested. Drain flies build up when a drain goes unused or uncleaned. Our iNaturalist data show fruit fly records peaking in October and November.

What smell do gnats hate?

We found no extension evidence that any household scent keeps indoor gnats away. Smell works better as bait: fruit flies are drawn to cider vinegar, which is why the jar trap works. For gnats that pester you outdoors, UC IPM says the repellents used for mosquitoes, such as products containing DEET or picaridin, give temporary relief from eye gnats, and UF says DEET is the main repellent used against biting midges. Follow the label.

What keeps the gnats away?

Taking away the conditions they breed in. Keep produce refrigerated or eaten, bins clean and sealed, drains brushed, and houseplant soil dry on the surface between waterings. Store potting mix closed and off the ground. Fit tight 16-mesh screens against fruit flies, though UF notes regular window screens do not exclude biting midges. Outdoors, cut standing water and avoid working fresh organic matter into damp soil near the house.

What attracts gnats to humans?

Different gnats want different things. Fungus gnats are drawn to light and often hover near faces and screens without biting. Eye gnats feed on eye fluid, sweat and other secretions, according to UC IPM. Biting midges respond to carbon dioxide and other host odours. Non-biting midges simply form mating swarms that people walk through. If you are being bitten rather than pestered, see a doctor for any reaction that worries you.

Sources

  • University of California Statewide IPM Program, Pest Notes: Fungus Gnats, Publication 7448.
  • University of California Statewide IPM Program, Pest Notes: Eye Gnats.
  • University of Kentucky Entomology, ENTFACT-621: Fruit Flies, M. F. Potter.
  • University of Kentucky Entomology, ENTFACT-657: Small Flies, Principato and DeVries, issued 2025, revised 2026.
  • University of Kentucky Entomology, ENTFACT-632: Non-Biting Midges and Gnats, A. Lopina, Z. DeVries and J. Larson.
  • University of Florida IFAS Extension, EENY-349 (IN626): Biting Midges, No-See-Ums, Culicoides spp.
  • Isberg, E., Bray, D. P., Hillbur, Y. and Ignell, R., Evaluation of Host-Derived Volatiles for Trapping Culicoides Biting Midges, Journal of Chemical Ecology (2017).
  • The Pest Control Brief analysis of iNaturalist research-grade records, pulled October 2026.
Got flies or pantry pests?Compare local quotes