How to Deter Flies Inside: What Really Works

The fastest way to deter flies inside your home is to eliminate what’s attracting them in the first place. Flies don’t wander indoors randomly. They follow scent trails to food, moisture, and organic decay. Once you remove those attractants and add a few physical barriers, most indoor fly problems resolve within days.

The approach that works best depends on which type of fly you’re dealing with, so it helps to identify them first.

Identify Which Flies You Have

Most indoor flies aren’t the large houseflies you swat at a barbecue. The four most common indoor species are fruit flies, drain flies, phorid flies, and fungus gnats. Each one breeds in a different spot, so knowing which you have tells you exactly where to focus your cleanup.

Fruit flies are tiny, tan or brown, and hover around your kitchen counter. They breed in any fermenting fruit or vegetable, and they’re especially drawn to overripe bananas, rotting onions or potatoes, spilled syrups, wine, and beer. If you see small flies near your fruit bowl or recycling bin, these are almost certainly the culprit.

Drain flies are fuzzy, moth-like, and tend to hang out on bathroom or kitchen walls near sinks. Their larvae live in the slimy microbial film that builds up inside drain pipes, feeding on bacteria, algae, and fungi in that film.

Phorid flies look similar to fruit flies but run in quick, jerky movements across surfaces instead of flying immediately. They breed in a wide range of decaying organic matter: garbage cans, drain pipes, wet potted plant soil, flowers sitting in old vase water, and even broken garbage disposals.

Fungus gnats are the tiny black flies that rise up from your houseplants when you water them. Their larvae live in moist potting soil, feeding on fungi and plant roots. If you only see flies near your plants, this is your problem.

Remove the Breeding Sources

No trap or spray will solve a fly problem if the breeding site stays active. A single fruit fly can lay hundreds of eggs, so killing adults while leaving a rotting potato in the back of a cabinet just keeps the cycle going. Sanitation is the most effective and most permanent fix.

For fruit flies, store ripe produce in the refrigerator and throw away anything overripe or damaged. Wipe down counters where fruit juice or alcohol may have spilled. Clean your recycling bin, especially if it holds wine bottles or beer cans. Empty kitchen trash daily during an active infestation.

For drain flies, scrub the inside of affected drains with a stiff brush to physically remove the biofilm where larvae live. Simply pouring bleach down the drain rarely works because the film clings to pipe walls and bleach flows past it. A drain brush or enzyme-based drain cleaner that dissolves organic buildup is more effective.

For fungus gnats, let the top inch or two of potting soil dry out completely between waterings. The larvae need consistent moisture to survive. You can also add a layer of coarse sand on top of the soil to discourage egg-laying.

For phorid flies, the challenge is finding the source. Check under appliances, inside trash cans, around floor drains, and anywhere organic material might be decomposing in a moist spot. Old flower water, a forgotten bag of potatoes, or food debris under the fridge are common culprits.

Set Up Traps for Active Flies

While you’re eliminating breeding sites, traps help knock down the adult population so you see results faster.

The simplest DIY option for fruit flies is a vinegar trap. Fill a small jar with about a quarter cup of apple cider vinegar and add a few drops of liquid dish soap. The vinegar’s fermentation scent draws the flies in, and the soap breaks the surface tension so they sink and drown instead of landing and flying away. Set a few of these near problem areas and replace them every few days.

For broader fly control, UV light traps work well in larger spaces. Commercial-grade units use ultraviolet bulbs to attract flies, then capture them on a glue board. Higher-end models can cover up to 4,000 square feet depending on room layout and line of sight, though a smaller residential unit is fine for most kitchens or living rooms. Place them away from competing light sources and at fly height (about 4 to 6 feet) for the best results. These are especially useful for houseflies and other larger species that aren’t drawn to vinegar.

Sticky traps, the simple yellow cards you can stake into plant pots, are the go-to for fungus gnats. The gnats are attracted to the yellow color and get stuck on contact.

Block Entry Points

If flies keep appearing even after you’ve cleaned up, they may be coming in from outside. Standard window screens with 18 to 20 holes per inch block most common flying insects, including houseflies and mosquitoes. If you’re dealing with gnats, which can be as small as 2 millimeters, you may need a finer 30-mesh screen to keep them out while still allowing reasonable airflow.

Check all your screens for tears or gaps, especially around the edges where they meet the frame. Inspect the seals around exterior doors, and make sure any pet doors close fully. Keeping exterior doors shut during peak fly hours (warm afternoons) makes a noticeable difference during summer months.

Use Airflow to Your Advantage

Flies are weak fliers. A steady breeze from a fan pointed at a doorway, dining table, or food prep area can keep them from landing. Ceiling fans on medium or high speed work for general room coverage. Tabletop fan deterrents designed specifically for outdoor dining use spinning blades to keep flies off food, and they work indoors too. The principle is simple: if the air is moving fast enough, flies can’t stabilize to land.

What Doesn’t Work

Ultrasonic pest repellers are widely marketed for indoor pest control, but scientific evaluations have found no evidence that they deter flies or other target pests. Testing at Cornell’s Integrated Pest Management program confirmed these devices are ineffective against insects, despite claims on their packaging. Save your money.

Carnivorous plants like Venus flytraps and pitcher plants are fun to grow, but they won’t control an indoor fly problem. Most species that are effective at catching flies need full outdoor sunlight to thrive. Smaller carnivorous plants like sundews and butterworts may catch the occasional gnat indoors, but not enough to make a dent in an active infestation.

Essential oil sprays (peppermint, lavender, citronella) may provide a brief deterrent effect in a small area, but they evaporate quickly and won’t prevent flies from breeding. They’re a cosmetic fix, not a solution.

A Practical Approach That Works

The most reliable strategy combines three steps in order of importance. First, find and remove every breeding source: rotting produce, dirty drains, overwatered plants, forgotten trash. Second, set out appropriate traps (vinegar for fruit flies, UV or sticky traps for others) to catch remaining adults. Third, seal entry points with intact screens and good door habits. Most people see a dramatic reduction within three to five days of thorough cleanup, with traps catching stragglers over the following week. If flies persist beyond two weeks despite consistent sanitation, the breeding source is still active somewhere you haven’t found yet.