Dre Campbell Farm
17 Natural Ways to Get Rid of Onion Flies

This post may contain affiliate links. Click here to view our affiliate disclosure

17 Natural Ways to Get Rid of Onion Flies

Onion flies are a common pest in onion fields. Their larvae can cause severe damage to your onion crops.

Fortunately, there are natural methods to help control these pests.


Onion flies resemble common houseflies. However, they are smaller and have a gray color and longer legs. Adults are about a quarter inches long. Their larvae, small white maggots, feed on onion bulbs and roots [1].

Affected plants wilt and turn yellow. The bulbs may also become soft and rot. You’ll likely see the larvae inside the bulbs. The plants may also emit a foul odor.

How to Get Rid of Onion Flies Naturally

Keep your onion plants healthy with these home remedies and natural solutions.

1. Natural Predators

Introduce beneficial insects like parasitic wasps. These wasps will prey on onion fly larvae. Hedgehogs, some birds, and some ground beetles can also help.

Steinernema feltiae beneficial nematodes are also effective against onion fly larvae [2]. Apply them to the soil around your plants. They will enter the larvae and release bacteria that will kill them, providing an organic pest control solution.

These natural predators can help keep onion fly populations under control.

2. Remove and Burn Infected Plants

Inspect your garden regularly and uproot infected plants immediately. Burn them to kill the larvae.

3. Powdered Hot Pepper

Powdered hot pepper is an excellent natural deterrent. Sprinkle it around your onion plants. The capsaicin in hot peppers will repel adult flies.

Reapply after rain for continued protection.

4. Powdered Ginger

Powdered ginger can also help deter onion flies. Mix it into the soil around your plants. The strong scent can discourage female flies from laying eggs.

Regular application boosts its effectiveness.

5. Plant Onion Sets Instead of Seeds

Planting onion sets instead of seeds can reduce vulnerability to onion fly larvae. Sets grow faster and are more resilient, minimizing the chances of infestation and ensuring a better yield.

6. Avoid Planting Onions in Rows

If possible, plant them in scattered patterns instead.

This confuses the maggots and prevents them from moving straight from plant to plant. It makes it harder for them to locate your crops.

7. Companion Planting

Scattering onions among other plants also helps.

Try planting onions alongside carrots, basil, or lavender. These plants can repel onion flies and other pests.

8. Cover the Garden with Insect-Proof Mesh

Use insect-proof mesh to cover your garden. This barrier helps keep adult flies away.

However, ensure the mesh is fine enough to block even the smallest flies. This method is effective and eco-friendly.

9. Wood Ash

Wood ash is a great deterrent for onion flies and root maggots. Sprinkle it around the base of your shallots, onions, and garlic plants.

Reapply after rain for continuous protection. Ash will also discourage slugs and snails from lingering in your garden.

10. Diatomaceous Earth

Sprinkle some diatomaceous earth around your onion plants. It will damage the exoskeleton of onion fly maggots, causing them to dehydrate and die.

It can also deter the female flies from laying eggs.

11. Yellow Sticky Fly Traps

Yellow sticky fly traps will also help reduce infestations as the adult flies get caught on them.

Place these traps around your garden. Also, regularly check and replace traps to maintain effectiveness.

12. Rotate Your Crops Frequently

Crop rotation helps disrupt the life cycle of onion flies. Avoid planting alliums in the same spot each growing season, especially if the soil is presently infected with this pest.

Rotate with non-host crops to reduce the likelihood of infestation.

13. Soapy Water

Soapy water is an easy homemade remedy that can kill onion flies if applied properly.

Mix water with a few drops of dish soap and spray it directly on the adult flies and maggots. The soap will suffocate and kill them.

14. Garlic Spray

Garlic spray is a natural repellent for many insect pests, including onion flies.

Crush a few garlic cloves and mix with water. Strain and mix a little dish soap with the garlic water.

Finally, spray this solution on your plants. The potent odor of the spray will repel onion flies.

15. Neem Oil

Neem oil is a powerful natural insecticide. It is effective against flies in general, so you can also use it as a natural deterrent for onion flies.

Make a homemade onion fly spray with 2 tablespoons of neem oil and a gallon of water.

Add a few drops of dish soap to help it stick to the plants. Spray this mixture on your onions. Focus on the base of the plants and surrounding soil.

16. Sand

Sand can also protect your onion bulbs and other alliums from this pest.

Cover the soil around your plant seedlings with a layer of sand. It prevents female flies from laying eggs on the soil surface near the plants.

Moreover, as the sun heats up the sand, the heat will kill any larvae trying to get to your seedlings.

17. Control Weeds

Weeds can also provide shelter for onion flies. Therefore, keep your garden weed-free. Mulching also helps to suppress weeds.


By using these natural remedies and organic products, you can naturally protect your onion plants and other allium crops from onion flies. Choose one or try a combination of remedies to help keep your garden free of both the adults and larvae.

Picture credit

Sasha Brown

Sasha Brown is a blogger and lover of all things natural.

Add comment

Organic pest control

DIY Pest Control