Flies are drawn to a combination of fermented sugars, decaying organic matter, and ultraviolet light, depending on the species. The most effective approach pairs the right attractant with a kill method, whether that’s a drowning trap, a toxic bait, or an electric grid. What works for tiny fruit flies in your kitchen won’t necessarily work for houseflies buzzing around your trash cans, so matching the trap to the fly is key.
What Attracts Different Types of Flies
Fruit flies zero in on fermenting sugars. Overripe bananas, spilled juice, and especially apple cider vinegar produce the sweet, slightly alcoholic scent they can’t resist. Houseflies have broader tastes. They feed by liquefying solid food with their saliva, so they’re attracted to garbage, animal waste, lawn clippings, and decaying fruits and vegetables. The commercial attractants designed for housefly traps smell genuinely foul because they mimic these rotting organic materials.
Blow flies (the metallic green or blue ones) are strongly drawn to carrion and protein-rich waste. In residential settings, they typically breed in food scraps and pet waste. Importantly, baits formulated for houseflies don’t work well on blow flies because the attractant chemistry targets different feeding preferences. If blow flies are your problem, you need odor-baited traps designed specifically for them.
Drain flies breed in the slimy organic film inside pipes and are best addressed by cleaning the drain itself rather than trapping adults.
The Apple Cider Vinegar Trap
This is the simplest and most effective DIY method for fruit flies. Fill a jar with about a quarter cup of apple cider vinegar and add a few drops of liquid dish soap. The vinegar’s fermented apple scent pulls fruit flies in, and the dish soap breaks the surface tension of the liquid so they can’t land and fly away. Instead, their wings get weighed down and they drown. In side-by-side testing, this basic setup consistently outperforms more elaborate homemade traps for fruit flies.
You can boost the trap by covering the jar with plastic wrap and poking small holes in it. Flies enter through the holes but struggle to find their way back out. Place traps near fruit bowls, compost bins, or wherever you’ve noticed the most activity.
The Sugar and Yeast Bottle Trap
For houseflies, a fermentation trap works better than vinegar. Mix one cup of sugar, one teaspoon of baker’s yeast, and one cup of warm water in a cut plastic bottle (cut the top third off, then invert it into the bottom to create a funnel). The yeast ferments the sugar, producing carbon dioxide and a sweet, decaying smell that houseflies find irresistible. Flies enter through the funnel and can’t navigate back out.
In a three-month comparison test of different homemade baits, the sugar and yeast mixture was the clear winner. The trap needs refreshing every week or two as the fermentation slows down.
UV Light Traps and Bug Zappers
Flies navigate using light, and their compound eyes are most sensitive to ultraviolet wavelengths between 365 and 395 nanometers. Their photoreceptors peak at around 370 to 385 nm. Once you move above 410 nm (into visible violet light), fly attraction drops sharply, by more than 25% compared to the optimal UV range. This is why UV-LED traps are so effective at pulling flies in from across a room.
Indoor UV traps come in two styles. Electric grid models zap flies on contact, while adhesive board models use a sticky surface to capture them silently. Adhesive traps are quieter, don’t produce the smell of singed insects, and work well in kitchens and bedrooms. A typical indoor unit covers around 400 square feet. Fan-based suction traps use a small fan to pull flies into a container once they approach the UV light, and they’re quiet enough for nurseries or offices.
Boric Acid Bait
Boric acid acts as a stomach poison in flies. When mixed into a sugar solution, flies feed on the sweet liquid and ingest a lethal dose. Research on granular boric acid sugar baits used concentrations ranging from 3% to 33% boric acid by dry weight in a 10% sugar-water solution. For home use, a lower concentration (around 3 to 5%) mixed into a sugar-water solution and placed in shallow dishes gives flies enough time to feed before the poison takes effect, which is important because if flies die too quickly, others won’t approach the bait.
Boric acid is relatively low in toxicity compared to commercial insecticides, but it should still be placed out of reach of children and pets.
Commercial Fly Baits
Store-bought fly baits use a synthetic version of the female housefly’s sex pheromone to attract males and other flies. This compound is chemically identical to what female houseflies naturally produce, and it’s effective against houseflies, stable flies, and horse flies. The pheromone itself is non-toxic. It simply lures flies to the bait, where a conventional insecticide does the killing.
The insecticides paired with the pheromone attractant vary by product and include both fast-acting nerve agents and slower-acting compounds. The characteristic turquoise blue granules sold at hardware stores for fly control typically contain 1% of a carbamate insecticide. These products pose a serious risk to pets. Dogs and cats that accidentally eat the granules can show poisoning symptoms within 15 minutes to an hour. If you have animals, keep commercial fly bait in enclosed bait stations or elevated locations that pets cannot reach.
Diatomaceous Earth as a Contact Killer
Food-grade diatomaceous earth kills flies through a purely physical mechanism. The microscopic fossilized shells have sharp edges that scratch the waxy outer coating of an insect’s exoskeleton. Once that protective layer is damaged, the powder absorbs oils and fats from the cuticle, and the fly dies from dehydration. It’s not a fast kill, but it’s chemical-free and works on any insect that crawls through it.
Dust it lightly around windowsills, garbage can lids, or other surfaces where flies land and rest. It loses effectiveness when wet, so it’s best for dry indoor areas or covered outdoor spots. The food-grade version is safe around people and pets, though you should avoid breathing in large amounts of the fine dust.
Picking the Right Approach
For fruit flies indoors, start with the apple cider vinegar and dish soap trap. It’s cheap, fast to set up, and genuinely effective. For houseflies, a sugar-yeast bottle trap or a UV adhesive trap will handle moderate problems. If you’re dealing with heavy fly pressure near garbage, compost, or animal areas, commercial pheromone baits placed in secure stations offer stronger control.
Combining methods works best. A UV trap running continuously catches flies day and night, while a vinegar trap near the kitchen sink targets fruit flies specifically. Diatomaceous earth on windowsills picks off stragglers. The most important step, though, is eliminating what’s breeding them in the first place: exposed garbage, overripe produce, pet waste, and dirty drains. No trap can outpace a breeding site that’s producing hundreds of new flies every few days.