Hot summer weather often invites the unwanted presence of fruit flies. If you leave a basket of fresh fruit on the kitchen counter for your kids to snack on, and later discover a few moldy peaches or bananas with black spots, along with the annoying buzzing sound around them, you may have a fruit fly issue. Get rid of these tiny pests by trying some of the elimination methods or traps below.
Steps
Set a Trap

Use Spoiled Fruit. The fruit fly problem might not be noticeable until you realize you’ve forgotten some fruit until it’s spoiled. Attract the flies to capture them; this method will completely eliminate the flies. Place a piece of spoiled fruit in a bowl, cover it with plastic wrap, and poke multiple holes in the surface using a toothpick. Leave it near areas where flies are common, as they will be attracted to the scent of the decaying fruit but won’t be able to escape.

Sacrifice a little wine. Humans aren't the only ones attracted to wine. Fruit flies are drawn to it as well. Be sure to have your fly-catching tools ready every time you open a bottle of wine. Pour the wine out, leaving about 2cm or less at the bottom of the bottle. Place the bottle near areas where flies tend to gather; they will fly inside, but the bottle's neck will trap them.

Try using apple cider vinegar. Apple cider vinegar is a household item that should be on hand, as it has many useful applications. One of them is its ability to kill fruit flies when their numbers explode. Pour some vinegar into a cup. Then cover the cup with a piece of plastic or paper shaped into a funnel. The funnel will block most of the entrance points, leaving a small enough gap for flies to enter but too small for the less savvy ones to escape. For a more potent solution, add some dish soap to the vinegar to create a fly-killing mixture.

Create a trap using dish soap. When mixed with a sweet solution, dish soap becomes undetectable by the flies. The chemicals in the soap act as poison, killing any careless flies. Take a container and fill it with a mixture of vinegar (any kind) and sugar—no need to worry about the ratio. Add a bit of dish soap and mix everything well. The flies will be attracted to the sweet and sour scent, but they'll die when they ingest the toxic soap.

Create a trap using beer. Now that you know fruit flies love alcoholic beverages, not just wine, here's another method. Take a paint can and pour beer into it, filling it halfway—any kind of beer will do. Use a hammer and nail to make a few small holes in the lid, about 3-5 holes. Seal the lid and place the can in areas where flies gather. After a few days, you can replace the beer with fresh beer to continue eliminating flies.

Use a soda bottle. If you're drinking soda, you're in luck. Take a soda bottle (any kind will do, though chocolate-flavored sodas seem more effective) and make a small hole in the cap. Pour out most of the soda, leaving just a little at the bottom. Open the cap and check for flies trapped inside!

Use yeast. This might sound strange, but a fermented mixture can help you catch and eliminate fruit flies. Take half a cup of warm water and one spoonful of sugar, then add a little dry yeast. Stir it up (bubbles will form!) and cover the cup with plastic. Poke small holes in the plastic to let the flies in, but remember, the holes must be small enough to prevent the flies from escaping.

Hang flypaper. This may be the least attractive fly trap option, but flypaper works very effectively. The super-sticky adhesive on the paper will attract and trap flies as soon as they land on it. Place the flypaper in an area you don't often frequent. You can even hang it above the kitchen sink for the best results.
Keep Your Space Fly-Free

Eliminate their habitat. Fruit flies are obviously drawn to fruits. However, they also seek out places that are dirty and filled with spoiled food. Try to get rid of any rotting food immediately, and keep areas like trash bins and drains clean and free of food scraps. This will help prevent your home from becoming a breeding ground for them.

Kill their eggs. If you notice an increase in the number of flies, it's likely that they've laid eggs somewhere in your home. Fruit flies love moist areas, such as kitchens, bathtubs, or bathroom drains. Pour disinfectant down the drain to kill the fly eggs if they're there. If you don't have disinfectant, bleach can be used as an alternative, though it’s weaker and may not stick to the eggs well enough to kill them.

Plant a basil plant indoors. Surprisingly, fruit flies dislike basil. If you plant this herb and keep it fresh and green, you'll help keep the flies away. Plant basil in a small pot and place it in your home near areas where flies tend to gather. Or, place it near a fruit basket, and you'll notice fewer flies in the future.

Use cedarwood. Another unusual natural enemy, fruit flies are repelled by the scent of cedarwood. Find ways to introduce this wood into your home, either as furniture or firewood, and the number of fruit flies will decrease. Place pieces of cedarwood around your kitchen and near where they lay eggs to keep the flies at bay.

Spray essential oils. Make your home smell better while deterring flies and other insects by frequently spraying with certain essential oils. Scents like lemongrass and lavender are effective at repelling flies and other bugs, preventing them from gathering in one spot. Mix 10 drops of one of these oils with 60ml of warm water, and spray it throughout your home.
Quick Fly Elimination

Make a fly swatter with a sticky coating. Like most people, your first instinct when you see a lot of flies is to swat them. Unfortunately, their small size makes them extremely hard to hit. To solve this problem, create a homemade sticky fly swatter. Take a piece of foam and spray it with a thick layer of cooking oil. When you swat those tiny flies, they will get stuck in the oil and adhere to the foam, eventually dying.

Use a hairdryer. If you're looking for revenge on those tiny, annoying flies, grab a hairdryer and point it at them! Turn on the hairdryer so the airflow blows from the fan, and the suction from the other side will pull the flies in. Once inside, they will be cooked by the heating coil. It sounds gross, of course. But those flies will disappear quickly.

Burn some mosquito incense. The respiratory system of fruit flies is incredibly small and delicate, and they rely on a continuous supply of fresh air. This means that respiratory irritants, such as smoke, can quickly kill them. Of course, you can't start a fire in your house, but burning mosquito incense works. The smoke and the scent from the incense sticks will gradually kill them.
Advice
- Fruit flies need around 8-10 days to mature from the time they hatch from their eggs, so continue using elimination methods even after the first generation of flies disappears. This will ensure that future generations are also eliminated.