What Are Flies Attracted To? How to Get Rid of Them

Learn what attracts flies to food, garbage, drains, plants, and compost, then follow a practical plan to identify, remove, trap, and prevent them.

By · Reviewed by LeafyPixels Review Board · Published · Updated · 16 min read

A fly trap and household inspection setup for identifying and controlling flies

If flies keep appearing, the important question is not only how to kill the ones you can see. It is what are flies attracted to in this particular room or yard? A fly that lands on your kitchen counter may be following a fermenting banana, a sticky recycling container, a drain film, damp potting mix, pet waste, or an opening that leads back outside.

The most reliable control plan has four parts: identify the likely fly, find the material supporting it, remove and clean that source, and block new arrivals. Traps and a swatter can make the room more comfortable while you work, but they rarely solve an infestation by themselves because eggs, larvae, or adults may still be developing somewhere nearby.

The Short Answer: Flies Follow Moisture and Organic Material

Most nuisance flies are attracted to a combination of odor, moisture, and decomposing organic material. That can mean garbage, animal waste, a dead animal, drain sludge, rotting produce, fermented drinks, wet compost, or a constantly damp plant pot. Illinois public-health guidance groups these materials together because they provide both food for adults and a place for some species to lay eggs (Illinois Department of Public Health).

The exact attractant depends on the fly. House flies favor garbage and feces; fruit flies seek ripening or fermenting produce and sweet liquids; drain flies develop in the gelatinous residue inside drains; phorid flies can point to hidden, high-protein decay; and fungus gnats are associated with moist potting mix. Cluster flies are a useful exception: they may enter a building for shelter rather than because a dirty food source is inside.

That distinction changes the first move. A vinegar trap makes sense for fruit flies but is a poor answer to a drain colony. Drying the surface of a houseplant pot can help fungus gnats but will not remove a house fly breeding in an outdoor bin. Start with the location and appearance of the fly, not the product aisle.

Identify the Fly Before Choosing a Fix

A close look at identifying a fly before choosing a control method

You do not need a microscope to make a useful first identification. Note the size, color, flight pattern, where the flies gather, and whether they sit on a surface or rise from a particular material. If you can safely capture one on clear tape or in a small container, keep it for comparison rather than crushing every specimen before you know what you are dealing with.

The Four Common Clues That Narrow the Source

What you noticeLikely flyWhat it suggestsFirst action
Larger gray fly, active in daylight, resting on walls or near doorsHouse flyGarbage, feces, compost, pet waste, or an outdoor sourceInspect bins, pet-waste areas, doors, screens, and nearby yards
Tiny tan or brown flies hovering over fruit, wine, soda, vinegar, or recyclingFruit flyOverripe produce, spills, bottles, trash juice, or a disposalRemove food sources, wash containers, then set a vinegar trap
Tiny fuzzy, moth-like flies resting near a sink, shower, or floor drainDrain flySlime and organic residue inside a drain or overflowTest the drain overnight, then scrub the drain walls
Tiny dark flies rising from plant soil or circling potsFungus gnatOverly wet potting mix, algae, fungi, or decaying materialLet the mix dry appropriately, use a surface barrier, and trap adults

This table is a starting point, not a laboratory identification. A small fly in a kitchen can be a fruit fly, phorid fly, or drain fly, and the sources can overlap. Extension guidance notes that phorid flies may run across surfaces with a short, erratic flight, while drain flies tend to make short jumps and hold their patterned wings roof-like over the body when resting (Pests In The Home). If the clues do not fit, collect a specimen and ask a local extension office or pest professional for help.

What Attracts Flies Inside a House

Food and Fermentation

Fruit flies are drawn to ripe and rotting fruit, vegetable scraps, juice, wine, beer, soda, syrup, vinegar, and the sticky film left behind by a spill. A single forgotten onion or potato in a dark pantry can be enough to keep a small population going. The source may be less obvious than the bowl of fruit: check under an appliance, inside a reusable shopping bag, beneath a refrigerator, and in the seam of a countertop compost caddy.

Unwashed bottles and cans can also preserve the scent that brings flies back. Rinse beverage containers before recycling, wipe the underside of a syrup bottle, and clean the rim of a recycling bin rather than simply tying a new bag. If food has leaked into the bottom of a trash can, removing the bag without washing the container leaves the attractant in place.

Fermentation is why fruit flies can appear even when all visible fruit looks fresh. Yeasts and microbes change sugary plant material as it ages, producing odors that signal an edible, moist surface. You do not have to sterilize the kitchen; you do have to remove the small wet residues that allow a new generation to develop.

Waste and Damp Organic Residue

House flies and other large filth flies are strongly associated with garbage, manure, animal feces, carrion, and decaying plant or animal material. A tightly closed indoor trash can reduces access, but the liner, lid hinge, floor beneath it, and outdoor bin can still hold odor and residue. Keep pet waste picked up promptly, and do not leave a bag of kitchen waste beside the back door for several days.

Recycling and compost deserve the same attention as garbage. Rinse containers, drain wet food packaging, use a lid that closes, and empty small countertop bins frequently. A compost pile should have enough dry carbon material and regular mixing to avoid a wet, exposed layer of fresh scraps at the top. If flies cluster around a bin, bury fresh scraps under finished material or browns and check for leakage underneath.

The source may be outside even when the flies are inside. Large flies often develop in outdoor waste, then follow odor through an open door or torn screen. If cleaning the kitchen changes nothing, walk the route from the most active window or doorway to the bins, pet area, compost, garage, shed, or neighboring property.

Drains, Plants, and Hidden Breeding Sites

A drain does not need to smell strongly to support flies. Grease, food particles, hair, soap residue, and other organic material can cling to the sides of a sink, disposal, overflow opening, shower drain, or floor drain. Running water may move loose debris while leaving the film where eggs and larvae remain. The Illinois guidance specifically describes drain-fly larvae living in gelatinous muck, which is why surface sprays and quick rinses so often disappoint (Illinois Department of Public Health).

Houseplants create a different small-fly clue. Fungus gnats spend their immature stage in damp potting mix, where larvae feed on fungi, algae, and sometimes roots. BBC Gardeners’ World recommends allowing the compost to dry between waterings when the plant can tolerate that cycle, adding a thin gravel or grit mulch, and using yellow sticky traps close to the soil; it also cautions that adult gnats are usually a nuisance while seedlings and weak plants are more vulnerable (BBC Gardeners’ World Magazine). Do not use this treatment on every small fly you see: it is for the potting-mix pattern, not fruit flies breeding in a drain.

Hidden sources deserve attention when flies keep returning after visible cleaning. Check the underside of a leaking cabinet, a wet mop head, a forgotten bag of produce, the space under a dishwasher, a clogged condensate line, a floor drain, or a wall void. A sudden wave of metallic blue or green blow flies, especially in one room, can indicate a dead rodent or bird in a chimney, attic, crawl space, or wall. That is a source problem, not a cue to keep spraying the windows.

How to Get Rid of Flies Step by Step

1. Find the Breeding Source Before Killing Adults

Testing a kitchen drain before cleaning it for possible fly breeding activity

Begin with a ten-minute inspection while the flies are active. Follow their concentration rather than cleaning randomly: watch where they land, whether they rise from a drain when disturbed, whether they hover at a plant pot, and which door or window they use. Put a clear cup or sticky monitor near two suspected locations for a night so you can compare activity.

For a suspected drain, place a clear plastic bag or a piece of transparent tape over the opening overnight, leaving enough room for the drain to function safely and avoiding any fixture that someone may use. If small flies appear beneath the cover, treat that drain as a likely breeding site. The extension source describes this simple overnight test and emphasizes that more than one breeding site may be present (Pests In The Home).

If you find maggots, do not assume the nearest adult flies came from the same place. Larvae can move away from their food before pupating, and adults can travel from a neighboring property or an outdoor bin. Note the location, remove the material if it is safe to do so, and escalate when the source is inaccessible, foul, or connected to a sewage or wildlife problem.

2. Remove and Clean the Source

Remove the material that supports the fly, then clean the surface that held it. Take out overripe produce, empty and wash the trash or recycling bin, rinse bottles, clean food from under appliances, scoop pet waste, and remove wet organic debris from around an outdoor bin. Dry the area afterward; moisture is part of the invitation.

For a drain, use a drain brush or another tool that can physically scrub the accessible sides and underside of the stopper and overflow. Follow any drain-cleaner label exactly, and never mix chemical products. If the drain is slow, leaking, repeatedly backing up, or inaccessible beyond the trap, a plumber or pest professional may be safer and more effective than improvising.

Do not overcorrect by disinfecting every surface while leaving the source intact. A clean counter beside a fermenting sponge, wet mop, dirty disposal flange, or leaking pipe will still produce flies. Source reduction is the durable step; washing the visible landing spots is the finishing step.

3. Trap the Adults Without Relying on Traps

A covered fruit-bait trap set up to catch adult flies

Traps are useful because they reduce the adults you see and reveal where activity is highest. A shallow dish of apple cider vinegar covered with plastic wrap and a few small holes can catch fruit flies; a few drops of dish soap in uncovered vinegar can also reduce surface tension so flies sink. Place traps near the source, not beside a clean doorway where you might draw flies toward the room.

Sticky cards, ribbons, a hand vacuum, and a fly swatter are practical for individual adults. Glue-board light traps can help with some larger flies when placed away from doors, windows, and food-preparation surfaces. The Cooperative Extension guide warns that traps are a relief measure while you locate the breeding material, not a substitute for cleaning it (Pests In The Home).

Use caution with sticky cards around curious children and pets, and keep liquid traps away from food, countertops used for preparation, and animals that may drink from them. Avoid electrocution-style zappers over food areas because insect fragments can scatter. Empty or replace traps when full and wash any surface contaminated by dead insects.

4. Seal the Route Back Inside

After source removal, stop the next group from entering. Repair torn window and door screens, replace a loose gasket, add a door sweep where daylight shows beneath the door, and keep exterior doors closed instead of propped open. Seal small gaps around pipes, vents, and utility penetrations only with a material appropriate for that location; do not block a required vent or create a moisture problem.

Air movement can make a patio door less inviting, and a fan aimed across a sitting area can help disrupt the weak flight of some flies. Research reviewed in PMC describes exclusion through screens, closed doors, fans, and properly maintained air curtains as part of integrated house-fly management, while also noting that exclusion works alongside sanitation rather than replacing it (A Review of Alternative Controls for House Flies).

If flies appear at night around a lit doorway, reduce the light spill, close the screen door promptly, and move trash or food odors away from that entrance. Outdoor lighting may affect where insects gather, but an attractive light is rarely the root cause of a breeding population. It is the open route that lets the problem inside.

Match the Fix to the Fly

Fruit Flies, Drain Flies, and Houseplant Flies

For fruit flies, remove every fermenting source before setting the trap. Refrigerate or cover produce, wash the fruit bowl, rinse bottles, clean the trash can and recycling bin, scrub sticky spills, and inspect the garbage disposal. Keep the vinegar trap out for several days after activity falls, because newly emerged adults may still be present.

For drain flies, repeat the overnight test on nearby drains rather than assuming the kitchen sink is responsible. Scrub the drain, stopper, overflow, and accessible trap; then keep the drain clean and dry between uses when practical. If activity continues in a bathroom or floor drain, investigate plumbing leaks, sewer connections, and inaccessible buildup instead of pouring stronger chemicals down the pipe.

For fungus gnats, adjust watering to the plant’s needs rather than letting a moisture-loving plant wilt. Allow the top portion of the mix to dry when the species tolerates it, improve drainage, remove dead leaves, and use a thin, breathable surface dressing plus yellow sticky traps near soil level. If a seedling or valuable collection is affected, isolate the pot and consider a labeled biological control only if it is appropriate for the crop and environment.

House Flies, Blow Flies, and Phorid Flies

For house flies, inspect all waste streams and entry points. Tight lids, frequent waste removal, prompt pet-waste pickup, and clean bin rims usually matter more than a room spray. If adults keep appearing at a window or door, look outside for manure, a garbage area, rotting vegetation, or a neighbor’s animal enclosure.

For blow flies, bottle flies, or flesh flies, a sudden localized increase is a reason to inspect for carrion. Check attic vents, chimneys, crawl spaces, roof voids, and areas where a pet or wildlife could be trapped. The Illinois Department of Public Health notes that large numbers of blow flies indoors often indicate a dead animal inside the structure (Illinois Department of Public Health). If the source cannot be reached without opening a wall or handling contaminated material, call a licensed professional.

For phorid flies, do not assume the fruit bowl is the answer. Their short, erratic movement and tendency to run across surfaces can point to high-protein decay, a wet trash residue, a broken drain, a plumbing leak, or an inaccessible organic source. Persistent phorid activity in a clean kitchen or bathroom deserves a more thorough plumbing and building inspection.

Outdoor Fly Control and Prevention

A patio fan used as one layer of outdoor fly control

Outdoor fly control starts with the same rule: remove the breeding material instead of trying to make a whole yard chemically hostile. Keep garbage lids tight, wash bin bottoms and wheels, move bins away from doors when possible, and rinse liquid residue before it ferments. Cover food at a barbecue and clean dropped meat, fruit, drink, and pet-food residue as soon as the gathering ends.

Manage compost as a living process. Bury fresh kitchen scraps, cover them with a balanced layer of dry leaves or other carbon-rich material, turn the pile when it becomes wet or compacted, and fix any leak that leaves a puddle below the bin. Do not place a fly-bait product where children, pets, pollinators, or food will contact it. If a pesticide is genuinely needed, use only a product labeled for flies and the exact site, follow its instructions, and keep people and animals away as directed.

Stable flies near a porch can be associated with wet straw, manure, rotting feed, or damp yard waste. Cluster flies around windows in late summer or fall are a different problem: they may be seeking shelter, so sealing cracks and screening openings is more useful than treating a food source that does not exist. The Illinois guidance identifies exclusion as the principal control for cluster flies (Illinois Department of Public Health).

A Weekly Fly-Prevention Routine

Use this short routine after the immediate infestation is under control:

  1. Kitchen: discard aging produce, wipe juice and alcohol spills, rinse recycling, and clean the trash-can lid and bottom.
  2. Drains: remove visible residue from sink strainers and stoppers, check for leaks, and investigate any drain with repeated fly activity.
  3. Plants: inspect saucers, remove fallen leaves, and water according to the plant rather than on a fixed calendar.
  4. Pets and wildlife: pick up feces, cover food, and look for dead animals or nesting material near vents and roof spaces.
  5. Outdoor waste: turn or cover compost, wash bins, remove wet yard debris, and keep manure or feed away from doors.
  6. Exclusion: test screens, door sweeps, vents, and gaps around pipes; repair the route that flies are using.

This routine works because it interrupts both sides of the problem. It removes the material that supports new flies and reduces the chance that adults will repeatedly enter. If the number of flies does not decline after a thorough cleanup and several days of monitoring, assume the source has been missed rather than concluding that you need a stronger spray.

What Not to Do With Sprays and Home Remedies

Do not treat every fly problem with a room fogger or repeated aerosol spraying. A spray can kill exposed adults while eggs, larvae, and pupae remain in a drain, bin, wall void, plant pot, or outdoor waste pile. Public-health guidance describes chemical control as a possible component of integrated management, but also emphasizes sanitation, inspection, exclusion, and the temporary nature of some adult treatments (Illinois Department of Public Health).

Do not assume a strong scent repels hungry flies, either. A peer-reviewed review of house-fly controls notes that many popular natural-odor claims lack solid evidence, and that sanitation and exclusion remain central to management (A Review of Alternative Controls for House Flies). Essential oils, herbs, pennies in bags, and candles may make a space smell different without removing the breeding source, and some can irritate people, damage surfaces, or harm pets if misused.

Do not pour random combinations of bleach, acids, drain cleaners, or insecticides into a drain. Chemical reactions can create dangerous fumes, damage plumbing, and still leave the organic film behind. If you use a pesticide, bait, strip, or drain product, read the label for the exact pest, location, ventilation, food-contact restrictions, and disposal instructions; the label is the controlling safety direction.

Finally, do not keep adding traps when the trap count is the only thing changing. A declining number of adults is encouraging, but the real test is whether new flies stop appearing after the source is removed. If flies continue for more than a week, appear in large numbers, emerge from an inaccessible void, or coincide with a sewage leak, dead animal, or vulnerable person’s living area, contact a licensed pest professional or the relevant plumbing, wildlife, or public-health service.

Conclusion

Flies are attracted to specific combinations of food, moisture, odor, and shelter, not to one universal household mistake. Fruit flies point toward fermenting produce and sweet residue, drain flies toward slime inside plumbing, fungus gnats toward damp potting mix, house flies toward waste and animal material, and blow flies toward carrion. The location and behavior of the fly are clues to the fix.

To get rid of flies for good, inspect first, remove the breeding source, clean the residue, use traps for the adults that remain, and seal the route back inside. Keep outdoor bins and compost managed, pick up pet waste, repair screens, and treat sprays or baits as limited, label-directed tools. Once you stop killing only the visible adults and start removing what supports the next generation, the problem becomes much easier to control.

Frequently asked questions

What are flies most attracted to in a house?

The most common attractants are moist organic materials and their odors: ripe or fermenting produce, sweet drinks, garbage juice, pet waste, dirty recycling, drain residue, wet mops, and damp plant soil. The right source depends on the fly, so check where the flies gather before choosing a trap or spray.

Why do flies keep coming back after I kill them?

Killing adults does not remove eggs, larvae, or pupae developing in a drain, bin, compost pile, pet-waste area, plant pot, wall void, or other hidden source. Inspect the area where activity is highest, remove and scrub the supporting material, then keep a trap out for several days while sealing entry points.

How can I tell fruit flies from drain flies?

Fruit flies are tiny tan or brown flies that hover around fruit, vinegar, wine, soda, and recycling. Drain flies are usually fuzzy or moth-like, rest near sinks, showers, and floor drains, and make short flights. Test a suspected drain overnight with clear tape or a loose plastic cover; flies caught there point to drain residue as the breeding site.

What is the safest first step for flies around houseplants?

First confirm that the flies rise from the potting mix, because fungus gnats need a different fix from fruit flies. Let the mix dry between waterings when the plant tolerates it, remove dead leaves, improve drainage, add a thin gravel or grit surface layer, and place yellow sticky traps close to the soil. Isolate heavily affected pots while you monitor them.

When should I call a professional for flies indoors?

Call a licensed pest professional when large numbers persist after careful sanitation, flies emerge from a wall, attic, chimney, crawl space, or sewer connection, you suspect a dead animal or plumbing leak, or the source is unsafe to handle. A professional can identify the fly and inspect inaccessible breeding sites instead of simply applying a broader spray.

How the "What Are Flies Attracted To? How to Get Rid of Them" guide is reviewed?

Editorial policyReview board

Written by · Reviewed by LeafyPixels Review Board · Updated September 22, 2026

This "What Are Flies Attracted To? How to Get Rid of Them" guide was researched and written by . Recommendations in the "What Are Flies Attracted To? How to Get Rid of Them" guide are checked against multiple independent references before publication.

We prioritize sources that hold up under scrutiny:

  • University cooperative extension bulletins and fact sheets (Penn State, Clemson, UMD, NC State, and similar programs)
  • Botanical garden and horticultural society publications
  • Peer-reviewed plant science and veterinary toxicology references where pet safety matters (including ASPCA Animal Poison Control)
  • Established reference works on indoor plant culture

The LeafyPixels editorial team then reviews the draft for clarity, step-by-step usefulness, and fit with real apartment and home conditions-not ideal greenhouse setups. When guidance changes materially, we update the page and note the revision date.


Sources used

  1. A Review of Alternative Controls for House Flies (n.d.) PMC8617729. [Online]. Available at: https://pmc.ncbi.nlm.nih.gov/articles/PMC8617729/ (Accessed: 22 September 2026).
  2. BBC Gardeners’ World Magazine (n.d.) How To Tackle House Plant Flies. [Online]. Available at: https://www.gardenersworld.com/house-plants/how-to-tackle-house-plant-flies/ (Accessed: 22 September 2026).
  3. Good Housekeeping: How to Get Rid of Fruit Flies Fast (n.d.) How To Kill Fruit Flies Per Experts. [Online]. Available at: https://www.goodhousekeeping.com/home/cleaning/a70699652/how-to-kill-fruit-flies-per-experts/ (Accessed: 22 September 2026).
  4. Illinois Department of Public Health (n.d.) House Flies Other Filth Flies. [Online]. Available at: https://dph.illinois.gov/topics-services/environmental-health-protection/structural-pest-control/house-flies-other-filth-flies.html (Accessed: 22 September 2026).
  5. Pests In The Home (n.d.) How To Get Rid Of Flies. [Online]. Available at: https://pestsinthehome.extension.org/stinging-biting-pests/how-to-get-rid-of-flies/ (Accessed: 22 September 2026).