How to Get Rid of Fruit Flies

Medically Reviewed by Jabeen Begum, MD on December 14, 2023
7 min read

The scientific name for the fruit fly is Drosophila melanogaster. The word “drosophila” means lover of dew. The species needs access to plenty of water in order to survive. 

What do fruit flies look like? Adult fruit flies have the typical fly body plan – they’re just much smaller than many other fly species. The average adult is 0.12 inches long and 0.08 inches wide.

The typical adult has a tan or black-brown body color and a rounded head. They have small antennae on their heads, three simple eyes, and large compound eyes. Their eyes are usually red. 

Fruit flies only have a single set of wings that come from the center of their abdominal region.

Gnats vs. fruit flies. Gnats are also members of the fly family. Compared to fruit flies, they have thinner bodies. They're darker – gnats are all black.

What do fruit flies eat? Fruit flies at all stages of development survive off of fruits. Adults also eat rotting plants. Freshly hatched larvae survive exclusively off of the food that they’re laid on. This is one of the main reasons they’re considered a common household pest.

Fruit flies originated in certain parts of the tropics. Human activity has spread them to every continent except Antarctica. They prefer temperate climates where they can access plenty of water. 

During colder months, you can find them trying to hide indoors, particularly in areas where you have a lot of food stored.

You likely have fruit flies because you have a lot of exposed food in an area. This is particularly true if you have fruit lying out in the open. They’re attracted to rotten and fermented fruits and vegetables as well as: 

Even unripened fruit is vulnerable to fruit flies. In fact, they prefer to lay their eggs on unripened fruit. This way, it will last until the eggs hatch.

No matter where in the U.S. you live, fruit flies can show up on your kitchen counters or inside your trash can. They 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. 

An adult female fruit fly can lay up to 2,000 eggs on the surface of anything that's moist and rotting. The eggs hatch into larvae, which eat the decayed food. The larvae mature into adults within a couple of days. Two days after they emerge as adults, they're ready to mate, and the females can lay more eggs.

Fruit fly lifespan. Several things influence the fruit fly life cycle, including the air temperature. Depending on conditions, an adult fruit fly can live as long as 30 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.

Fruit flies can become a huge financial burden when they invade food storage facilities. A large infestation can consume and destroy a lot of food in a relatively short period of time. 

In your own home, the main threat that fruit flies pose is in their ability to ruin your fruit. 

Do fruit flies bite? Fruit flies don't bite humans. 

To get rid of all the fruit flies in your home, you'll need to find where they are breeding:

Fruit flies in the bathroom. Fruit flies lay their eggs in moist areas, which means they can show up in your bathroom. A mop or bucket that has wet residue can attract them. Flies may be getting into your house through window screens. You may need 16 mesh or finer to keep them out. 

Fruit flies in drains. Drains are wet and may have scummy residue in them, which makes them an ideal fruit fly breeding spot. If you think a drain might be harboring fruit flies, tape a plastic food-storage bag over it and let the plastic sit overnight. If you find fruit flies trapped in the bag, the drain is infested. Clean your drains regularly and sanitize with boiling water. You may need to use a brush and industrial drain cleaner.

Fruit flies in plants. Dry the soil out to eliminate the breeding spot. Spreading sand on top of the soil may help. 

Fruit flies in the kitchen. Get rid of produce – bananas and tomatoes are common culprits – that are attracting the flies. Inspect anywhere you store fruit or vegetables, including potatoes and onions. Fruit flies can breed in drawers where you keep produce. Check under your refrigerator for spills. Wipe down counters and all surfaces. You may need to empty your garbage each night and clean out the can. Do the same with recycling bins. 

Fruit fly spray. You can buy sprays to kill fruit flies, but they will kill only the hatched adults, not the eggs or larvae. Look for products that contain pyrethrum.

Do-it-yourself fly traps for fruit flies are very easy to make, and they’re versatile, too. These homemade fly traps can be made from things you probably have at home already.

Supplies you’ll need:

  • A glass or plastic cup or jar. A clear container is best so you can see how well it’s working and when it’s time to switch it out for a new one.
  • A lid that fits snugly. This can be a plastic lid or some plastic wrap held on with rubber bands. The lid that typically comes with glass jars won’t work, as you need to be able to poke holes in it.
  • Rubber bands, if you’re using plastic wrap
  • Toothpicks or something equally thin and pointy
  • A liquid to attract the fruit flies. Fruit flies are most attracted to fermenting things, so water with yeast in it or apple cider vinegar are both excellent options. You can also use wine or a piece of over-ripe fruit.
  • Flypaper (optional)

How to make a fruit fly trap:

  1. Set out your jar or cup. If you’re using apple cider vinegar, fill it a few inches deep. If you’re planning to use yeast and water, pour a quarter of a cup to a third of a cup of warm water and add a package of dry activated yeast. Add a teaspoon of sugar to activate the yeast and mix. In a few moments, you’ll notice the mixture starting to foam. This is normal.
  2. If you’d like, you can also add a piece of flypaper inside the jar. This helps trap the bugs and makes sure they can’t escape.
  3. Cover the lid with plastic. If you’re using a plastic lid, make sure it’s snug. If you’re using something like plastic wrap or a plastic bag, secure it with a rubber band. For glass jars, you can also use a canning ring.
  4. Poke small holes in the lid. These holes can't be bigger than an eighth of an inch, or the flies may be able to escape. Toothpicks are great for this, but you can also use things like sharp pencils.
  5. Wait – the flies should arrive soon.
  6. The fruit flies that crawl into your trap won't be able to get out. Some of the captured females may lay eggs, which will hatch. 
  7. Your second-generation fruit flies will take about 10 days to mature. At this point, you may want to dump the contents of your trap. If you dump in down the drain, be sure to flush it with hot water. 
  8. If you still have fruit flies, make a new trap and start the process again. 

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 or an air-tight container.
  • 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.
  • Squeeze out mops and cleaning towels thoroughly. 
  • Pick up and throw away any outside garden vegetables or fruit that has fallen to the ground and is rotting.