How to Prevent Fruit Flies

12 Ways to Prevent a Fruit Fly Infestation

Fruit flies on tomatoes in kitchen
dlinca / Getty Images

If you like to have fresh fruits and vegetables in your house, then you have probably encountered a tiny pest that likes them as well: the fruit fly (Drosophila melanogaster). Of course, there's seldom just one fruit fly because these pests breed and reproduce so quickly. That's great for scientists doing genetic research, because the fruit fly's life cycle is only eight days, but not so much fun when flies are buzzing around your kitchen.

While the flies don't sting or bite, they can cause foodborne illness by spreading bacteria from contaminated foods to other surfaces in the home. Research has shown that fruit flies are a significant vector in the spread of Escherichia coli (E. coli).

Once you have a fruit fly infestation, you'll want to eliminate them as quickly as possible (possibly with a homemade fruit fly trap). But, there are steps you can take to prevent an infestation of fruit flies from becoming a bigger problem.

  1. Know What Fruit Flies Love

    Fruit flies are drawn to anything containing sugar that ferments into alcohol—overly ripe fruit, beer, or wine, to name a few common items. If they can't readily find their very favorite foods, they will search it out in sticky garbage cans, compost bins, sink drains, and recycling bins. Doing some routine housekeeping chores can help solve the problem!

  2. Wash and Inspect Produce

    When you bring home produce from the market, carefully inspect it for any bruising or damage. Wash the produce well before using or storing it to remove fruit fly eggs or larvae that may have hitched a ride.

  3. Store Fruit and Produce Properly

    While a bowl of fruit on a counter is lovely and easy to access, it is best to store fruits in the refrigerator to slow the ripening process and prevent the attraction of fruit flies. Only place uncovered fruit that will be consumed within a few hours on the counter.

  4. Dispose of Damaged Fruit Correctly

    Once fruit and vegetables become overly ripe or damaged, tossing them in a kitchen waste bin will still attract fruit flies. Instead, place the rotten fruit or peelings in a covered compost bin, outdoor compost pile, or place in a sealed bag in an outdoor waste container.

  5. Clean Food Preparation Areas Promptly

    Fruit flies can find that tiny piece of fruit or drops of spilled wine very quickly. Prompt and thorough cleaning of counters, tables, small appliances, and dishes after any type of food preparation or service will help prevent an infestation.

    One key area to clean well is the kitchen sink and garbage disposal. Bits of food can become trapped in the drains. Clean and flush out drains and disposals well after each use for food preparation.

  6. Wash Sponges and Dishcloths Frequently

    When you finish cleaning up the kitchen, there are probably bits of food trapped in the sponge, brush, dishcloth, or mop you used. Don't leave a sticky cleaning tool lying around to attract fruit flies. Toss the items into the washer or dishwasher instead.

  7. Keep Windows and Doors Closed

    Fruit flies are so tiny that they can slip through window and door screens. Keep doors and windows closed as a better deterrent.

  8. Control Indoor Humidity

    Keeping indoor humidity rates low slows the deterioration of fruit. Use a dehumidifier and air conditioner to help keep humidity as low as possible.

  9. Blow Them Away

    If you are working with lots of produce during a marathon meal preparation or food preservation session, put an oscillating fan in the kitchen to keep the air moving. This will help prevent the flies from landing on the foods to lay eggs and shorten the cycle of the infestation.

  10. Check the Pantry

    There's no fruit on the counter but you still have flies. Why? It could be something rotting in the pantry. Fruit flies like mushy potatoes and onions just as much as bananas.

  11. Pay Attention to Your Trash Can

    While you can have an outbreak of fruit flies during any season, summer is a key time because of the abundance of produce and the added heat and humidity. If there's lots of eating going on, it is worth your time to empty the trash can twice a day to an outdoor container. The trash can should also be washed out with an all-purpose cleaner or dishwashing liquid and water at least weekly to remove any seepage and stickiness in the bottom that can attract fruit flies.

  12. Rinse out Recyclables

    If you have a bin for recyclables, be sure to rinse out bottles and cans before you toss them in the bin. A few drops of beer, wine, or soft drink is ambrosia to a fruit fly. Use this tip even if the bin is outside: Fruit flies like to sneak into your kitchen every time a door is opened, so empty the bins often and give indoor and outdoor bins frequent cleanings to eliminate food sources for fruit flies.

Article Sources
The Spruce uses only high-quality sources, including peer-reviewed studies, to support the facts within our articles. Read our editorial process to learn more about how we fact-check and keep our content accurate, reliable, and trustworthy.
  1. Indoor Flies and Their Control. Texas A&M Extension Service

    1. Buyukyavuz, Ahmet, et al. Escherichia Coli Transfer to Food by Fruit Flies during Short Time ExposureJournal of Food Research, vol. 7, no. 4, 2018, p. 131., doi:10.5539/jfr.v7n4p131