Rats will flee a garden when they encounter the scent of onions, according to experts, who describe the vegetable as a powerful natural deterrent. Lorin Mielsen at Epic Gardening said rats "hate" the pungent smell of onions, and placing one where rodents are suspected to enter will make them "take one smell and run out of your garden".
Why onions repel rats
The specialists at Buzz Boss have called onions a "cooking staple that's a nemesis of rats". They explained that onions contain sulphur compounds that irritate the eyes and nose of rats, as well as allicin, which can cause anaemia and oxygen deprivation if ingested.
Onions are effective even without growing them in the garden. Simply place an onion at suspected entry points, but replace it every few days to prevent rotting. Planting garlic around garden beds can also deter a wide range of pests, not just rodents.
How to use onions in the garden
For a steady supply, the specialists at Buzz Boss recommend growing onions in the garden. Onions are a cool-season crop that can be grown from seeds, sets, or transplants. They thrive in full sunlight and rich, moist soil, and can be harvested once the bulbs are fully mature and the foliage turns yellow and falls over.
Rats are attracted to gardens because they offer food, water, and shelter. Fallen fruit, vegetable patches, compost bins, and bird feeders provide food, while dense shrubs, sheds, and wood piles offer hiding places. Rats can damage plants, leave droppings, carry diseases such as leptospirosis, salmonella, and hantavirus, and breed rapidly, so prompt action is advised.



