This article provides practical information about the onion fly – how to recognise it, where it occurs in the UK, how to prevent infestations, and how to control or eliminate this pest from gardens, farms, and homes.
In the UK, the onion fly is also known as the onion maggot (referring to its larval stage).
What does an onion fly look like?
The adult onion fly is similar in appearance to the common housefly but tends to be slightly smaller and greyer. It typically measures around 6–7 mm in length and features a rounded, compact body, large reddish eyes, and translucent wings. It can be difficult to distinguish without close inspection, as it resembles many other small fly species.
The larvae, or onion maggots, are the damaging stage. They are small, white, legless, and tapered, reaching up to 8 mm long. These maggots tunnel into onion bulbs and stems, leading to rot and plant decline.
Where are onion flies found in the UK?
Onion flies are widespread throughout the UK, particularly in areas with established vegetable gardens or commercial onion cultivation. They are common in temperate regions and especially active during the spring and summer growing seasons.
You’ll typically encounter onion flies:
-
In domestic gardens where onions, leeks, or garlic are grown
-
On allotments and market gardens
-
In compost heaps containing decaying vegetable matter
-
In soil that previously hosted onion crops
Where do onion flies live and reproduce?
The onion fly overwinters in the soil as pupae. Adults emerge in spring and lay their eggs at the base of host plants, particularly in moist soil conditions. A single female can lay up to 200 eggs.
Once hatched, the larvae burrow into onion bulbs or stems and feed for several weeks. After feeding, they pupate in the soil and may complete up to three life cycles per year in southern parts of the UK, depending on the weather.
They prefer:
-
Moist, cool soil conditions
-
Garden beds with dense allium planting
-
Fields with a history of onion cultivation
-
Compost piles and undisturbed organic matter
How do you avoid onion fly infestations?
Preventative steps are essential to reduce the risk of onion fly problems. Good cultural practices make a significant difference in keeping the pest population down.
Crop rotation
Avoid growing onions or other alliums (such as shallots, garlic, or leeks) in the same spot every year. The onion fly’s pupae survive in the soil and will emerge near familiar host plants.
Row covers
Use fine mesh or horticultural fleece over onion beds from planting time until mid-summer. This acts as a physical barrier, preventing egg-laying by adult flies.
Delayed planting
Sowing onions later in the season, once the first generation of flies has emerged and died, can help avoid initial infestations.
Remove plant waste
Dispose of any rotting or unused onion parts, including those left in the soil or compost, as these can attract flies for egg-laying.
How do you identify onion fly damage?
Onion fly larvae begin feeding shortly after hatching, and symptoms appear within 1–2 weeks. Look out for the following signs:
-
Yellowing or wilting of onion leaves
-
Stunted plant growth
-
Bulbs that feel soft, mushy, or emit a foul odour
-
Visible white maggots at the base of the plant or inside the bulb
In advanced infestations, entire rows of plants may collapse or rot.
How do you get rid of onion flies?
Remove infested plants
If you spot maggots, remove the affected plants immediately. Dispose of them in sealed waste – do not compost – to avoid spreading the pest.
Soil solarisation
In warmer months, cover bare soil with clear plastic sheeting for several weeks to raise soil temperatures and destroy pupae.
Sticky traps
Place yellow sticky traps near crops to monitor adult fly activity. These won’t eliminate the population but can help identify peak fly presence for timing control efforts.
Biological controls
Beneficial nematodes such as Steinernema feltiae can be watered into the soil to attack the pupae. Predatory beetles and parasitic wasps may also help reduce populations in balanced ecosystems.
Insecticides
Chemical control is available, but timing is critical. Products should be applied when adults are active or just before egg-laying. Always follow local regulations and choose treatments approved for use on edible crops.
What is the onion fly's life cycle?
The onion fly has a complete life cycle with several generations per year:
-
Eggs: Laid in the soil near host plants in spring.
-
Larvae: Hatch and burrow into bulbs to feed for 2–3 weeks.
-
Pupae: Develop in the soil, where they either hatch into new adults or overwinter.
-
Adults: Emerge from pupae, ready to mate and repeat the cycle.
In the UK climate, two generations per year are common, but a third may occur during warmer summers.
Can onion flies infest indoor spaces?
While onion flies prefer outdoor environments, they may occasionally be found indoors, especially if infested onions are brought inside. This is most common when storing home-grown onions that weren’t properly cured or inspected.
To avoid indoor issues:
-
Store onions in dry, well-ventilated conditions
-
Remove any damaged or rotting bulbs promptly
-
Keep storage areas clean and free of plant debris
Are onion flies harmful to other crops?
The onion fly targets members of the allium family, including:
-
Onions
-
Garlic
-
Shallots
-
Leeks
-
Chives
Other vegetables are not directly affected, but planting alliums near one another can intensify infestations. Some gardeners use intercropping strategies with carrots or herbs to mask the smell of onions and confuse the adult flies.