Maggots come from fly eggs. A female fly lands on decaying organic material, lays a cluster of eggs, and within about 24 hours those eggs hatch into the soft, pale larvae we call maggots. They don’t appear out of nowhere, even though it can seem that way when you lift a trash can lid and find hundreds of them overnight.
How Flies Choose Where to Lay Eggs
Flies are drawn to rotting material by smell. As food, meat, or other organic matter decomposes, it releases volatile chemicals into the air. Research on blowflies has identified specific compounds released during decay that attract egg-laying females, with certain chemicals spiking at the exact stages of decomposition that flies find most appealing. The worse something smells to you, the more attractive it is to a fly looking for a nursery.
A single female fly can deposit up to 300 eggs in one batch, often tucked into crevices or folds where the eggs stay moist. Common egg-laying sites include kitchen trash cans, outdoor garbage bins, pet waste, compost piles, forgotten fruit, and any meat or animal product left at room temperature. The eggs are tiny, white or yellowish, and easy to miss. By the time you notice maggots, the eggs hatched hours ago.
From Egg to Maggot to Fly
The fly life cycle has four stages: egg, larva (maggot), pupa, and adult fly. Eggs hatch in roughly one day under typical conditions, though this varies with temperature and species. Warmer environments speed things up considerably, while cooler temperatures slow development or prevent hatching entirely. At sustained high heat (around 90°F or above), egg viability drops sharply, and prolonged exposure to extreme warmth can kill eggs outright.
Once hatched, maggots feed voraciously on the surrounding decaying material, growing through three size stages called instars. Each stage is predictable and temperature-dependent. After the feeding phase, which lasts several days to a couple of weeks depending on conditions, maggots crawl away from the food source to pupate. The pupa is a dark, hard-shelled casing where the larva transforms into an adult fly. When the adult emerges, it can begin laying eggs within days, restarting the cycle.
Why They Seem to Appear From Nowhere
For centuries, people believed maggots materialized spontaneously from rotting meat. In 1668, Italian physician Francesco Redi designed an elegant experiment to test this. He placed meat in six containers: two open to the air, two covered with gauze, and two sealed completely. Maggots appeared only in the open jars where flies could land directly on the meat. The gauze-covered jars attracted flies that landed on the fabric but couldn’t reach the meat, and no maggots formed. The sealed jars produced none either. Redi concluded that maggots are the offspring of flies, not a product of decay itself.
The reason maggots seem to materialize is simply that fly eggs are nearly invisible, and flies are fast. A fly needs only seconds of contact with exposed food to deposit eggs. You won’t always see it happen, but the results show up within a day.
Which Flies Produce Maggots
Several fly families are responsible for the maggots people encounter most often. Blowflies (the shiny green or blue ones) are among the first to arrive at any decaying animal matter. House flies lay eggs on a wide range of organic waste, from kitchen scraps to pet feces. Fruit flies target overripe produce and fermented liquids. Agricultural species like cabbage maggots and seedcorn maggots attack crops and garden plants. The species varies, but the process is always the same: eggs laid on or near a food source, hatching into larvae that feed on that material.
Maggots on Living Tissue
In rare cases, fly larvae end up in or on living human tissue, a condition called myiasis. According to the CDC, this can happen several ways. Some flies lay eggs directly near open wounds, sores, or body openings like the nose or ears. Others attach their eggs to biting insects like mosquitoes or ticks, and the larvae transfer to a person when that insect bites. In parts of Africa, one species lays eggs on damp clothing hung out to dry, and larvae can burrow into skin when the clothing is worn. Certain species’ larvae can migrate deeper into tissue and cause serious damage. Myiasis is most common in tropical and subtropical regions and rare in temperate climates.
Medical and Forensic Uses
Not all maggot encounters are unwelcome. Medical professionals have used fly larvae to clean wounds for centuries. Aboriginal Australians and Maya tribes in Central America applied larvae to wounds long before modern medicine. In 1929, an orthopedic surgeon at Johns Hopkins became the first Western doctor to formally use green bottle fly larvae to treat infected bone wounds, noting rapid cleaning of dead tissue, reduced bacteria, and less odor. The practice faded after antibiotics became widely available in the 1940s, but as antibiotic resistance grew, maggot therapy made a comeback in the late 1980s and is now used in both European and American clinical settings for severe, infected wounds that resist conventional treatment.
Forensic scientists also rely on maggots. Because larvae develop at predictable, temperature-dependent rates, forensic entomologists can collect maggots from human remains, identify the species, measure their size and developmental stage, and work backward using local temperature data to estimate when flies first colonized the body. This gives investigators a minimum time since death. Each larval stage requires a specific amount of accumulated heat (measured in degree-hours or degree-days), making the calculation surprisingly precise when good weather data is available.
How to Keep Maggots Out of Your Home
Since maggots always start with a fly finding something to lay eggs on, prevention comes down to two things: removing what attracts flies and blocking their access.
- Take out trash frequently. This matters most after cooking with meat, fish, or dairy. If your indoor bin has food waste in it, don’t let it sit overnight in warm weather.
- Use a sealed trash can. An overfilled or lidless bin is an open invitation. Make sure the lid closes completely.
- Rinse food containers before tossing them. Residue in takeout containers, jars, and cans is enough to attract egg-laying flies.
- Clean your bin periodically. Leaked liquids at the bottom of a trash can create exactly the kind of environment flies seek. Wipe it out with a sanitizing solution every few weeks.
- Seal outdoor bags tightly. Double-knot bags without drawstrings. If flies can’t reach the contents, they can’t lay eggs.
- Keep outdoor bins in the shade. Heat accelerates decomposition, which intensifies the odors that draw flies. A shaded, cool spot makes your bins less of a target.
- Separate food scraps when possible. Keeping organic waste out of your regular trash, whether through composting in a sealed system or drying scraps, eliminates the primary attractant.
The speed of the fly life cycle is what makes prevention feel urgent. A single fly visit to an open trash bag can produce hundreds of maggots by the next morning. Keeping things sealed, clean, and cool breaks the cycle before it starts.

