Attracting flies comes down to exploiting their senses: smell, sight, and chemical signals. Whether you’re baiting a trap for pest control, luring black soldier flies to a compost bin, or catching fruit flies in your kitchen, the approach changes depending on the species. Here’s what actually works for each situation and why.
Attracting Fruit Flies
Fruit flies zero in on the volatile chemicals released by fermenting organic matter. Ripe and overripe bananas, melons, tomatoes, squash, and apples are their strongest natural draws, along with rotting potatoes and onions. The common thread is fermentation: as sugars break down, they produce the alcohols and esters that fruit flies can detect from surprisingly far away.
The most effective homemade bait is simple. Pour about a quarter inch of apple cider vinegar or wine into a jar and add a few drops of dish soap. The vinegar mimics the smell of fermenting fruit, and the soap breaks the surface tension so flies sink instead of landing and flying off. Beer works as a substitute if you don’t have vinegar on hand.
For a stronger lure, mix a yeast-based bait: dissolve one packet of active dry yeast (about two tablespoons) in a third of a cup of warm water, then stir in a teaspoon of sugar. This creates an active fermentation that continuously releases carbon dioxide and alcohol vapors. Fruit fly larvae hatch within 30 hours and feed on yeast in fermenting liquid, so the bait essentially mimics their ideal breeding site. Place the jar wherever fruit flies are most active, typically near kitchen counters, trash cans, or fruit bowls, and replace the contents once the trap fills up.
Attracting House Flies
House flies respond to a broader and less pleasant set of smells than fruit flies. Decomposing meat, fish, manure, and garbage all generate the sulfur compounds and ammonia that pull house flies in from a distance. For trap purposes, a small piece of raw meat or fish left to sit in warm water for a day creates a potent bait.
A simpler option is the sugar and yeast method: one cup of sugar, one teaspoon of baker’s yeast, and one cup of water mixed together. The dry ingredients store easily and can be mixed on site, making this practical for greenhouses, barns, or outdoor areas. The fermentation produces a steady stream of attractant over several days.
Commercial fly attractants use a synthetic version of a pheromone that house flies naturally produce. This compound works as an aggregation signal, drawing both males and females to the area. In field tests, adding it to traps increased catches anywhere from 3 to 12 times depending on the trap type, with the biggest gains seen on electric grid traps. The pheromone works best at short range, so it’s most effective when combined with a food-based bait that pulls flies in from farther away. You’ll find it pre-applied on commercial fly strips and sticky traps sold at hardware stores.
Using Light and Color
Flies see ultraviolet light that’s invisible to humans, and they’re strongly drawn to it. UV light traps use bulbs that emit peak wavelengths around 360 to 370 nanometers, in the near-ultraviolet range. Standard blacklight bulbs outperform “blacklight blue” bulbs because they produce higher intensity in that attractive wavelength band, even though they look similar to our eyes.
Color matters too. Dark surfaces near a light source help by providing contrast. Commercial UV traps pair bright bulbs with black glue boards positioned above and below the light, creating a visual target flies orient toward. If you’re building a DIY light trap, placing a UV or blacklight bulb near a dark sticky surface at night will pull in a wide range of fly species. Keep the trap away from competing light sources, since flies will go to the brightest UV source available.
Attracting Black Soldier Flies
Black soldier flies are a different case entirely. People attract them intentionally for composting, since their larvae break down organic waste faster than most other methods. Adults don’t eat. They’re drawn to the smell of decomposing organic matter purely as an egg-laying site.
The strongest attractants are high-odor substrates: livestock manure, food scraps, spent coffee grounds, brewing grains, and even carrion. Table scraps, restaurant leftovers, and produce waste all work well. The key is letting the material begin to decompose so it generates the volatile compounds that female flies follow. Adults also respond to the presence of other black soldier flies, so an established colony attracts more newcomers.
Females lay their eggs near food but not directly on it. Provide an egg-laying substrate like strips of corrugated cardboard suspended inside or above the compost bin. They’ll tuck their eggs into the cardboard flutes, and newly hatched larvae drop down into the food below. Keep the bin’s moisture between 50 and 70 percent relative humidity. Look for a moist substrate with light condensation on the inside walls of a sealed bin as a visual guide. Too dry and the eggs desiccate; too wet and the bin goes anaerobic and attracts the wrong species.
Trap Placement and Maintenance
Where you put your attractant matters as much as what’s in it. For indoor fruit fly traps, position them directly where you see fly activity. For outdoor house fly traps, place them 15 to 20 feet from seating or eating areas. The bait will pull flies toward the trap and away from you, but only if the trap isn’t competing with other food sources nearby. Clean up fallen fruit, exposed garbage, and pet waste in the area so the trap is the strongest signal around.
Replace liquid baits every five to seven days, or sooner in hot weather when fermentation accelerates and the bait loses potency. Meat-based baits break down faster and should be swapped every two to three days. If you’re composting food scraps that might attract unwanted flies indoors, store produce peels and other organic matter in a sealed bag in the freezer until trash day. The cold kills any eggs and prevents larvae from hatching.
For any bait involving raw meat or decomposing material, wash your hands thoroughly after handling. House flies are known carriers of bacteria, and the organic matter used to attract them is no cleaner. Use gloves when refreshing outdoor traps, and keep meat-based baits in containers that pets and wildlife can’t access.