Have you ever found your kitchen teeming with fruit flies that seemed to have appeared out of nowhere? These tiny nuisances can quickly multiply in number, and they are tough to get rid of once they arrive. So, how did these fruit flies end up in your kitchen? Here's a hint: It isn't a case of spontaneous generation.

Fruit Flies Follow Fermenting Fruit

What we consider "fruit flies" includes a number of small flies in the family Drosophilidae, such as the species Drosophila melanogaster (the common fruit fly) and Drosophila suzukii (the Asian fruit fly). These insects are very small—about two to four millimeters long—and vary in color from yellow to brown to black. They are found throughout the world but are most common in tropical areas with humid climates.

Fruit flies are built to find fermenting fruit. Though small, they can detect the smell of ripe fruits and vegetables from a good distance away; if there's a bowl of fruit on your kitchen counter, there's probably a fruit fly or two looking for a way into your home to get to it. Because these insects are so tiny, they can get in through window screens or crevices around windows or doors. Once inside, they lay eggs on the skin of very ripe or fermenting fruit. They reproduce, and before you know it, you've got yourself a full-fledged fruit fly infestation.

Sometimes, fruit flies hitch a ride into your home on fruits or vegetables. Yes, those bananas you brought home from the grocery store may already harbor a new generation of fruit flies. If you let your tomatoes over ripen on the vine before picking them, you may be harvesting fruit fly eggs along with your crop. All unrefrigerated fruit, whether it's on display at the grocery store, still in the garden, or sitting in a bowl on your kitchen table, may attract fruit flies.

1:22 Watch Now: Where Fruit Flies Come From (and How to Get Rid of Them)

How a Few Fruit Flies Quickly Becomes an Infestation

Fruit flies have notoriously fast life cycles; they can go from egg to adult in just eight days. That means that one overly ripe tomato left unused on your counter can give rise to a small fruit fly swarm within a week. Fruit flies are also known for their persistence once indoors. Although a female fruit fly adult will only live about a month at best, she can lay 500 eggs in that short time.﻿﻿ The insects don't even need fruit to keep reproducing. Fruit flies can breed in the slime layer inside slow-draining plumbing or on an old, sour mop or sponge. This is why even if you get rid of all your fruit, you can still find your home infested with fruit flies.

Get Rid of Fruit Flies for Good

To extinguish a fruit fly infestation, you'll need to eliminate all possible food sources and make your home inhospitable to breeding adult fruit flies. One of the best ways to catch breeding adults quickly is to make a vinegar trap. Other tips and tricks for getting rid of fruit flies include throwing out old fruits and vegetables, cleaning recycling bins and trash cans, and replacing old sponges and rags. A thorough cleaning will ensure that your kitchen is free of anything that might attract these pests.