Onion maggot is the hidden enemy of the onion bed. The plants look fine in spring, then a few start to yellow, wilt and fall over, and when you pull one up the bulb is soft, rotting and tunnelled with small white maggots. The fly that causes it is small and easy to miss, the damage is underground, and the maggots move from plant to plant along the row, so a small attack can spread through a whole bed in a matter of weeks.

Like the carrot rust fly, the onion maggot is best beaten by prevention — row cover, rotation and timing — rather than by trying to rescue an infested crop. This guide explains how to identify the pest, how its lifecycle shapes the control calendar, and the organic-first steps in order. If the damage on your onions does not match, the pest identifier helper can help you compare symptoms.

How to identify onion maggot

The adult is a small grey fly, about 6–7 mm long, similar in appearance to a small housefly. It is rarely noticed, and most gardeners never see it. The eggs are tiny and white, laid in the soil at the base of onion plants or in cracks near the bulb. The larvae are the damaging stage: small, creamy-white maggots, legless, up to about 8 mm long, with a blunt rear end.

The reliable identification is the damage. Young onion plants yellow, wilt and collapse, and the bulb at the base is soft and rotting, often tunnelled with maggots inside. The roots may be eaten away, so the plant pulls up easily. In a heavy attack, maggots move from a dead plant to the next one along the row, and the damage spreads in a patch. The smell of a rotting onion bulb is another clue — healthy onions do not smell, but a maggot-infested bulb rots quickly and smells bad.

Lifecycle in general terms

There are usually two or three generations a year, depending on climate. The first generation of adults emerges in spring, often around the time onion sets are planted, and lays eggs at the base of young plants. The eggs hatch within a few days, and the maggots burrow into the bulb and feed for two to three weeks. They then pupate in the soil, and the next generation of adults emerges a few weeks later. The final generation pupates in the soil and overwinters there, emerging the following spring.

The first generation is usually the most damaging, because it attacks young plants that cannot tolerate root loss. Later generations attack larger bulbs, which can sometimes survive light feeding. The pupae overwinter in the soil where onions grew, which is why rotation and end-of-season hygiene matter so much.

Damage signs

The first sign is usually a patch of yellowing, wilting plants in the onion bed, often starting with one or two plants and spreading along the row. The affected plants pull up easily because the roots have been eaten, and the bulb is soft, discoloured and tunnelled, often with white maggots visible inside. In severe cases the whole bulb rots away. Leeks, garlic, shallots and chives can all be attacked, though onions are the main host — check the whole allium family if you see damage on one of them.

Onion maggot damage is sometimes confused with onion white rot or basal rot, which are fungal diseases. The difference is the maggots: if you find small white maggots in the bulb, it is the fly; if the bulb is rotting with white fluffy growth and no maggots, it is more likely a disease. The plant disease checker can help you compare the two.

Damage is often worse in cool, damp springs, in beds where onions were grown the previous year, and where onion debris was left in the soil. A first-year bed in fresh ground usually has far less trouble.

Organic-first control, in order

1. Inspect first. From the time onion sets go in, check the bed weekly for yellowing or wilting plants. Pull up any suspect plant and inspect the bulb for maggots. Early detection matters because removing an infested plant promptly can stop the maggots moving to the next one along the row.

2. Hand-pick and remove. Pull out infested plants as soon as you find them, with the bulb and the maggots inside, and put them in the bin or a sealed bag — do not compost them. Check the neighbouring plants and remove any that are wilting. This is the most effective rescue step once an attack has started, and it limits the spread along the row.

3. Barriers. Cover the onion bed with fine insect mesh or fleece from planting until the bulbs are well grown, sealed at the edges. This keeps the adult flies from laying eggs and is the most reliable control available. It works best when the cover goes on at planting time, before the first generation of flies arrives. Row cover also protects against other allium pests.

4. Traps. Yellow sticky traps placed low over the bed catch adult flies and show you when they are active. They will not control the pest on their own, but they help you time your covering and your inspections, and they give an early warning each season.

5. Beneficial insects and soil life. Ground beetles and other soil predators eat some of the eggs and larvae, and a healthy, biologically active soil supports them. Avoid bare, compacted soil in the onion bed, and keep the soil surface mulched lightly once the plants are established. Beneficial nematodes watered into the soil can attack the larvae, though results vary with soil moisture and temperature — check your local extension service for advice on the right species and timing.

6. Least-toxic options last. There are few least-toxic products that reliably reach maggots inside the bulb, and spraying the adult flies is impractical for a home gardener. A dusting of wood ash or diatomaceous earth around the base of the plants is traditional and may deter egg-laying in dry weather, but it needs reapplying after rain and should be seen as a supplement to row cover, not a replacement. Always check your local extension service for products approved in your area.

Prevention

Prevention is where this pest is beaten. Rotate onions and all their relatives — leeks, garlic, shallots, chives — to fresh ground every year, and do not grow them in the same bed more than once in three or four years. Clear away all onion debris, unharvested bulbs and old roots at the end of the season, because pupae overwinter in the soil and in leftover bulbs. Avoid planting onion sets in soil that had onions the previous year, and do not leave cull onions or damaged bulbs lying around the garden. Plant sets and transplants promptly and firmly, and avoid damaging the bulbs at planting time, since the flies are attracted to the smell of damaged onion tissue. Choose resistant varieties where they are available — some onion varieties are less attractive to the fly — and ask your local extension service or seed supplier what suits your area. Growing onions alongside garlic is fine, but remember they share the same pest, so rotate them together as one family.

Frequently asked questions

Can I eat onions with maggot damage? Lightly damaged bulbs can sometimes be salvaged by cutting away the affected parts, but badly tunnelled or rotting bulbs should be discarded. Do not store damaged bulbs — they rot quickly and can spoil the rest of the store.

Why did only one patch of my onion bed die? Onion maggot spreads along the row from plant to plant, so damage often starts in one spot and spreads. It can also be worse where the soil stayed damp or where sets were damaged at planting. Pull the affected plants promptly to limit the spread.

Do onion sets or seeds make a difference? Sets are often more vulnerable because they are planted early, when the first generation of flies is active, and because damaged sets attract egg-laying. Seeds sown later can sometimes escape the worst of the first generation, but they still need row cover in gardens where the fly is established.

Will the maggots attack my garlic? They can, though onions are the preferred host. Garlic, leeks, shallots and chives are all in the same family and can be attacked, especially if onions are nearby. Cover and rotate the whole allium family together.

How long do the pupae survive in the soil? They overwinter in the soil and emerge the following spring, so a bed that grew onions this year will still hold pupae next spring. Rotation to fresh ground is the only reliable way to break the cycle — check your local extension service for the recommended rotation interval in your area.

Onion maggot is a pest that rewards a clean, planned approach. Cover the bed from planting, rotate the allium family every year, pull infested plants at once, and clear the ground at the end of the season — and the bulbs you lift in summer will be sound. For the related root fly of carrots, see our carrot rust fly guide, and for general help use the pest identifier helper.