How to Get Rid of Fruit Flies

Medically Reviewed by Kathleen M. Zelman, RD, LD, MPH on September 09, 2023
4 min read

Those tiny "gnats" you see circling an overripe banana on your kitchen counter? They aren’t gnats at all. They're fruit flies. Not only are they annoying, they can also be bad for your health. But there are plenty of ways to make them go away for good.

No matter where in the U.S. you live, fruit flies can show up on your kitchen counters or inside your trash can. They can turn up any time of year but are most common in the late summer and early fall. That's because they're attracted to ripe and rotting food.

Fruits and vegetables -- especially bananas, melon, tomatoes, squash, and apples -- are their favorites. Rotten onions and potatoes are also a big draw for these tiny, 1/8-inch-long creatures.

An adult female fruit fly can lay up to 2,000 eggs on the surface of anything that's moist and rotting. Within 30 hours, tiny maggots hatch and start to eat the decayed food. Within 2 days, they're all grown up and ready to mate, too. While that transition may seem quick, a fruit fly only lives 8 to 15 days.

Research shows that fruit flies can transfer germs from a dirty surface onto a clean one. Some of the bacteria they may carry include salmonella, E. coli, and listeria. These three germs each cause food poisoning. Severe cases may put you in the hospital and can even be life-threatening.

If you have a fruit fly problem, insect sprays will kill the adult insects but won't stop eggs from hatching. To get rid of all the fruit files in your home, you'll need to:

  • Look for places where fruit flies can breed. Check for and clean up sticky spills or rotting food on your counters, inside drawers and cabinets, inside and under your refrigerator, and under other kitchen appliances. Aside from overripe fruit and veggies, fruit flies can lay their eggs on cleaning rags and mops, and even in empty cans.
  • Clean your drain and garbage disposal. You can pour boiling water into them or tape a clear plastic food storage bag over the top and leave in place overnight. Adult fruit flies will try to leave the drain, and you'll find them in the bag in the morning.
  • Make traps. Place them wherever you have seen fruit flies.
    • Wine trap: Fill the bottom of a small jar with a splash of wine. Make a cone out of a piece of paper. Put the cone on top of the jar with the narrow end pointing up. The wine attracts the flies. The cone keeps them in the jar.
    • Rotten fruit trap: Follow the steps above, but put a piece of rotten fruit at the bottom of the jar.
    • Apple cider vinegar trap: Follow the steps above, but put apple cider vinegar in the jar.
    • Apple cider vinegar and dish soap trap: Mix the ingredients in a container. The vinegar will lure the flies in, but the dish soap makes it hard for them to get away.
    • Yeast trap: Follow the steps above but swap the vinegar mixes for ¼ to ⅓ cup water, a packet of activated dry yeast and a teaspoon of sugar.
  • Use bug spray with caution. If you do want to try an insect spray or fog, remember that they contain poisonous chemicals. Carefully read the label and follow the safety guidelines. Keep away from children and animals.

To prevent fruit flies from getting too comfortable in your house again:

  • Buy only what you're sure you'll eat. One spoiled potato or forgotten box of berries can lead to thousands of fruit flies. Once produce gets ripe, put it in your refrigerator until you eat it. Compost the leftovers or throw them away promptly.
  • Wash your produce when you get it home (to remove any eggs or larvae) and then store it in the refrigerator.
  • Empty your kitchen trash can every day.
  • Clean up any spills right away (especially alcohol or fruit juices).
  • Rinse your recycling. Make sure all jars, bottles, and cans are free of food scraps.
  • Put screens on your windows and doors. Look for tight-fitting, 16-mesh models that can keep adult fruit flies from coming inside your home.
  • Turn off lights over your doors and windows. Light attracts newly adult fruit flies.
  • Seal all containers. If you preserve your own fruits and veggies or brew your own cider or beer, check that your lids are well sealed. If not, fruit flies can squeeze under them and lay eggs.

Show Sources


Journal of Food Protection: Fruit Flies as Potential Vectors of Foodborne Illness.

University of Kentucky College of Agriculture, Food and Environment: "Fruit Flies."

Eco-Cycle: "All About Composting."

Michigan State University Extension: "How To Get Rid of Fruit Flies In Your Home."

Northwest Center for Alternatives to Pesticides: "Fruit Flies."

CDC: "Burden of Foodborne Illness: Findings."

PennState Extension: "Vinegar Flies." Pest Management Association: "Fruit Flies."

University of Maryland Extension: “Fruit Flies.”

Nebraska Extension in Lancaster County: “Fruit Fly Trap Instructions.”

Iowa State University Extension and Outreach: “‘Tis the Season for Fruit Fly Control.”

View privacy policy, copyright and trust info