Flies are attracted to a combination of smells, moisture, warmth, and light, but odor is by far the dominant driver. Their antennae are coated with tiny sensory hairs that detect airborne chemicals at remarkably low concentrations, drawing them toward food sources, breeding sites, and fermenting organic matter. The specific attractants vary by species, which is why different types of flies show up in different parts of your home.
How Flies Detect Smells
A fly’s “nose” is its pair of antennae. These antennae are covered in thin hairs called sensilla, each containing olfactory neurons. Odor molecules drift into tiny pores on these hairs and bind to receptors, triggering the fly to navigate toward the source. Fruit flies have roughly 50 different odorant receptors (compared to 400 to 500 in humans), yet those receptors are finely tuned to the specific chemicals that signal food and breeding opportunities. This explains why a single overripe banana on your counter can summon flies that weren’t visible moments earlier.
What Attracts House Flies
House flies respond to two broad categories of odor: fetid and sweet. The fetid category includes the compounds you’d expect. Sulfur-based chemicals like dimethyl trisulfide and nitrogen compounds like indole, both present in animal manure and decaying meat, are strong attractants. Carboxylic acids produced during fermentation (acetic acid, butyric acid, isovaleric acid, and hexanoic acid) also pull house flies in. These are the same volatile chemicals released by garbage, compost bins, and food waste left in trash cans.
The sweet category is less intuitive. House flies are also drawn to floral-smelling compounds called monoterpenes, including linalool and terpinolene, which are found in flowers and some fruits. Benzaldehyde, the compound responsible for the smell of almonds and cherries, and a grassy-smelling compound found in cut leaves have both shown promising attractant properties in research. This dual attraction to both rotting and sweet scents explains why house flies land on your food as eagerly as they land on trash.
Warmth, moisture, and carbon dioxide also play roles. House flies gravitate toward warm, humid environments where organic matter is breaking down, because those are ideal egg-laying sites. A single female lays 75 to 150 eggs per batch and can deposit 350 to 900 eggs in her lifetime. She targets moist materials like fresh manure, wet straw, or decomposing food scraps. Eggs hatch in as little as 8 to 20 hours, and under good conditions, larvae develop through three stages in just 3 to 7 days. That speed is why a small attractant source can become a serious fly problem within a week or two.
What Attracts Fruit Flies
Fruit flies are specialists in fermentation. The chemicals that attract them most strongly are the byproducts of yeast breaking down sugars: acetic acid (the main component of vinegar), ethanol (alcohol), and ethyl acetate (a fruity-smelling solvent). This is why fruit flies swarm around wine glasses, beer bottles, overripe fruit, and kombucha. The connection runs deep. Fruit flies have a documented association with specific yeast species found on ripening fruit, and they essentially follow yeast activity as a food-finding strategy.
In controlled experiments, simple alcohols like methanol, ethanol, and propanol all attracted significantly more fruit flies than plain water. Formic acid and acetic acid did the same. Even various ester compounds, the chemicals responsible for fruity and floral aromas in wine and ripe fruit, proved attractive. Researchers testing monitoring baits found that a combination of rice vinegar and merlot wine outperformed other vinegar and wine pairings, likely because that combination produces a broader spectrum of fermentation volatiles.
This is exactly why the classic apple cider vinegar trap works. The vinegar releases acetic acid and other fermentation byproducts that fruit flies find irresistible. Adding a drop of dish soap breaks the surface tension of the liquid, so when flies land on it, their wings get wet and they can’t escape. It’s a simple exploit of their strongest chemical attraction.
What Attracts Drain Flies
Drain flies are drawn to something most people don’t think about: the slimy biofilm coating the inside of pipes. This gelatinous layer of bacteria, fungi, grease, and decomposing organic matter builds up in kitchen drains, shower drains, and anywhere water sits without fully drying out. The odors released by this decaying sludge attract adult drain flies, which then lay their eggs right at the surface of the film.
Larvae live inside the biofilm itself, feeding on bacteria, fungi, microorganisms, and grease. Drain flies also breed in septic systems, sewage plant filters, and any continuously wet surface where organic material accumulates. Adults are attracted to light as well, which is why you’ll often spot them near bathroom mirrors or kitchen windows. They enter homes through the drains themselves, through small cracks, or through open windows. If you’re seeing drain flies, the attractant isn’t something on your counter. It’s inside your plumbing.
Light, Color, and Visual Cues
While smell is the primary attractant, flies also use visual information to find targets. House flies are drawn to ultraviolet light, which is the principle behind UV fly traps used in restaurants and commercial kitchens. They also respond to contrasting dark and light patterns, which may explain why they land on certain surfaces more than others. Fruit flies tend to gravitate toward warm yellow and orange tones, consistent with the color of ripening fruit. Once a fly gets close enough for visual cues to matter, the combination of smell and sight helps it zero in on the source.
Common Household Attractants
Knowing the chemistry helps, but practically speaking, here’s what’s pulling flies into your living space:
- Exposed fruit: Ripening bananas, peaches, and berries release ethanol and esters as sugars ferment, creating a beacon for fruit flies.
- Garbage and compost: Any mix of food waste, moisture, and warmth generates the carboxylic acids and sulfur compounds that attract house flies and blow flies.
- Dirty drains: Biofilm buildup in kitchen sinks, shower drains, and floor drains attracts drain flies and provides a breeding site in one package.
- Pet waste and litter boxes: Ammonia, indole, and other nitrogen compounds in animal waste are potent house fly attractants.
- Standing water with organic matter: Bird baths, clogged gutters, and plant saucers with algae growth attract multiple fly species looking for moisture and breeding sites.
- Open beverages: Wine, beer, juice, and soda release fermentation volatiles and sugars that attract both fruit flies and house flies.
Why Flies Multiply So Quickly Near Attractants
The reason a minor attractant becomes a major problem is reproductive speed. House flies produce six to eight generations per year. Under warm conditions, the entire lifecycle from egg to adult can complete in as little as two weeks, with the adult emerging from its pupal case in as few as three days when temperatures are high. A single female beginning to lay eggs near a food source can theoretically produce hundreds of offspring, each of which reaches reproductive maturity within weeks.
Fruit flies are even faster. Their generation time can be as short as 8 to 10 days in warm kitchens. A forgotten piece of fruit or an unwashed recycling bin gives them everything they need: fermentation odors to find the site, sugars and yeast to feed on, and moist organic material to lay eggs in. Removing the attractant is always more effective than trying to kill individual flies, because as long as the source remains, new generations keep hatching.