Keep rats out of a compost heap with two things working together: physically stop them getting in, and don't feed them. Line the base of the bin with rat-proof galvanised mesh, fit a secure lid, and keep cooked food, meat, dairy and starchy waste such as bread out. Lift the lid to turn the heap and a rat's presence shows as a hole dug at the base, hollowed-out material, droppings, a nest of shredded cardboard or leaves, or a smell sharper than earthy rot, closer to ammonia. Rats find compost heaps attractive, and once one has moved in it keeps coming back until the conditions that drew it change.
The signs
Rats are wary of anything new, so you're likelier to find evidence than see one, often at dusk or after dark, as scratching or rustling in the heap. Look for:
- A hole at the base of the heap or bin, often where it meets the ground, where a rat has burrowed in from below. Rat entrance holes are around 30 to 40mm across.
- Droppings: dark, cylindrical with rounded ends and about 15mm long, roughly twice the size of a mouse's, often clustered near an entry point.
- Gnaw marks on wooden panels, plastic lids or bin corners.
- A nest of shredded paper, cardboard or dry leaves in a hollowed-out cavity.
- Greasy rub marks along the inside edge of a bin or a fence line, where a rat runs the same route repeatedly and body oil darkens a smear.
- A strong ammonia smell, unlike the sweeter smell of compost breaking down, from concentrated urine at a nesting site.
One sign is worth investigating; two or more together mean an active presence, not a one-off visitor. Don't assume every hole or dropping is a rat: house mice leave smaller versions of the same signs, and a gap too small for a rat can still let a mouse through, so mesh sized to stop rats won't automatically stop mice.
Wear gloves when handling any part of a heap showing these signs, and wash your hands afterwards. Rat urine can carry leptospirosis (Weil's disease), which infects through cuts and abrasions or by ingestion and can persist in wet places. The risk from ordinary garden contact is low but worth respecting. Don't use compost from a rat-infested heap on raw vegetables that are eaten unwashed, such as radishes and strawberries.
Why heaps attract rats
The rat in a Scottish garden is the same brown rat (Rattus norvegicus) as across the UK, and it wants shelter and food. An undisturbed pile of organic material, rarely turned, is a warm, dry, hidden nesting site, particularly in the colder months, and depending on what goes in it can also be an easy meal. A heap that is turned regularly is harder to nest in. Rats breed year-round, with females producing up to five litters a year, so get the exclusion measures below in place before autumn rather than once one has settled in. Bird feeders and spilled seed nearby are a common co-attractant that can draw rats into a garden in the first place, so don't let bird food accumulate.
Exclusion: the most effective measure
Stop rats getting in from underneath. An open-bottomed bin on bare earth is easy to burrow beneath, and once a rat is inside, the lid barely matters. Line the base with galvanised wire mesh before you site the bin. Look for mesh sold specifically as rodent or rat-proof, since ordinary chicken wire's holes are often wide enough for a young rat to squeeze through. Edinburgh's home composting guide recommends covering the base with fine wire (it says chicken wire) to stop vermin entering from underneath while still letting worms and other beneficial creatures in, which is the balance you want. Use mesh that is rat-proof, not wide-holed netting.

- A well-fitting, secure lid. A rat that can lift or squeeze under a loose lid will use it. Edinburgh's guide suggests a heavy rock on the lid, or a piece of old carpet over the heap, to make it harder to get at.
- No gaps at the joins. Panel bins can develop gaps at the corners as they age or warp, so check them periodically.
- A hard, level surface, or mesh-lined earth. A bin on paving removes the burrowing route entirely; on soil, lay the mesh first and site the bin on top, which still gives worms and drainage access (see hot composting vs cold piles).
A raised bin such as a tumbler on a frame removes the burrowing route by design, and a good choice if you have back problems or need the bin off the ground. A tumbler is also usually fully enclosed with a secure lid, but keep meat, dairy, cooked food and starchy waste out of it, since a determined rat can exploit any gap at a join.

What not to compost
Composting advice usually says to avoid meat, dairy and cooked food because of smell and pathogens. For rats the simpler test is: can a rat eat it, and would it want to? Raw vegetable peelings and garden waste are of little interest once they begin to break down.
| Waste type | Attractive to rats? | Where it should go instead |
|---|---|---|
| Raw vegetable and fruit peelings | No | Compost heap, fine as usual |
| Garden waste (grass, leaves, prunings) | No | Compost heap, fine as usual |
| Bread and other starchy or grain waste | Yes | Food waste caddy, or a bokashi system |
| Cooked food (any) | Yes | Food waste caddy, or a bokashi system |
| Meat and fish | Yes | Food waste caddy, or a bokashi system |
| Dairy | Yes | Food waste caddy, or a bokashi system |
Burying fresh kitchen scraps under soil or a layer of dry material such as leaves and cardboard gives a rat far less scent to home in on than peelings left on the surface. The Soil Association advises avoiding grains such as bread and couscous, along with meat and cooked food, because they attract vermin. Edinburgh's guide puts it plainly: "Do not try to home compost meat, dairy or cooked foods", and if you leave cooked, starchy, meat and dairy scraps off the heap, there should not be anything there to attract pets or vermin.
If you do want to compost cooked food, meat or dairy, don't put it in an open heap and hope; pre-treat it. A bokashi system ferments food waste in a sealed container with an inoculated bran, and the result is inedible to rats once it is ready to dig into soil or add to a heap. A properly hot-running compost system can also process cooked food and dairy safely, because sustained heat breaks the material down before it becomes an attractive meal; hot composting vs cold piles explains how to get a heap hot.
Open heap or enclosed bin
An open heap, or one contained by loose pallets or netting, is easier for a rat to get into and nest in than a fully enclosed bin with a lid. A lidded bin with a mesh-lined base does most of the exclusion work by design. An open heap relies on there being nothing attractive in it, a harder standard to keep consistently.
Real deterrents and folklore
- Peppermint oil. No composting or pest-control authority documents it as an effective rat deterrent. It is a widely repeated folk remedy, not a documented one.
- Ultrasonic repellers. They are marketed heavily, but credible evidence for their effect on rodents is lacking, and rodents are reported to habituate to the sound within days.
Put the effort into the mesh base and the food list, where the evidence is. Keep both going alongside any professional treatment, not instead of it.
The Scottish angle
Nothing suggests Scotland's brown rats behave differently for composting purposes, so the advice is UK-wide. City of Edinburgh Council publishes its own composting guidance covering mesh-lined bases, secure lids and keeping meat, dairy and cooked food out. If your compost is on a shared allotment plot or a tenement back green, a rat problem is rarely just yours: tell your allotment association or neighbours early, since one poorly excluded bin can draw rats to everyone's plot.
If you already have rats
- Remove attractants immediately. Clear out cooked food, meat, dairy and starchy waste and stop adding it.
- Retrofit exclusion. Add a mesh-lined base if there isn't one, and check the lid fits and there are no gaps at the joins.
- Consider professional pest control for an established infestation. Repeated activity, a nest or several animals is usually beyond what exclusion and diet changes will resolve quickly.
Don't improvise with traps or poison. Rodenticides sold to the public are restricted under UK stewardship rules, and the wrong product, or one left where pets, birds or other wildlife can reach it, causes harm beyond the rat it was aimed at. Councils have a duty to keep their district free from rats and mice and can require an occupier to deal with an infestation, but there is no duty to provide a free treatment, and services and charges vary by council: some charge a fee (West Lothian, for example, around £190 for a full course of treatment when last checked) while others have offered the service free. Check what your own council offers rather than assuming it is free or covered. The RSPCA's wildlife advice is a good place to start for humane guidance.
Common questions
Will putting my compost bin on a paving slab instead of soil stop rats?
It removes the burrowing route from underneath, which is one of the two main ways rats get into a heap, but it won't help if the heap still contains food that attracts them. Exclusion and diet need to be addressed together.
Does a compost tumbler solve the rat problem on its own?
It goes a long way, because being raised off the ground removes the burrowing route, and a tumbler is usually fully enclosed with a secure lid too. It's still worth keeping meat, dairy, cooked food and starchy waste out of it, since a determined rat can exploit any gap at a join or lid seal.
Do ultrasonic pest repellers keep rats away from compost?
No credible evidence shows they work against rodents, which are reported to get used to the sound within days, and no institutional source recommends them as an effective deterrent.
Is it true that peppermint oil deters rats from compost heaps?
This isn't supported by evidence from the composting and gardening organisations that cover rat deterrence. It's a widely repeated folk remedy rather than a documented one.
Is rat urine on my compost dangerous?
It carries a small risk of leptospirosis (Weil's disease). Wear gloves when handling material from a heap that's shown signs of rats, and wash your hands afterwards, ordinary sensible hygiene rather than a reason to avoid composting altogether.
Sources
Show the 8 sources
- RHS: Rats: Brown rat identification; droppings about 15mm and twice the size of mouse droppings; entrance holes 30-40mm; leptospirosis through cuts or ingestion; up to five litters a year; seal bins, do not let bird food accumulate; avoid compost from rat-infested heaps on raw vegetables such as radishes and strawberries
- West Lothian Council: Rats: Example of a Scottish council charging for rat treatment on private property (charge as reported, check current fee)
- Prevention of Damage by Pests Act 1949: Local authority duty to keep its district free from rats and mice, and power to require occupiers to act; no duty to provide a free service
- RHS: Composting: General siting and base guidance (bare earth for drainage and soil-organism access, or a hard surface with added soil, and covering against rain); not used for any rat-specific claim
- Garden Organic: Different composting methods: Raised tumbler bins helping specifically against rats, bokashi pre-treatment making food waste inedible to rats, and hot composting bins processing cooked food/dairy safely
- Soil Association: How to make your own compost: Advice to avoid grains, meat, and cooked food specifically because they attract vermin
- City of Edinburgh Council: Home composting guide (what can/can't go in the bin): The direct instruction not to home-compost meat, dairy, or cooked foods, and to use a food waste caddy, bokashi system, or food waste digester instead
- City of Edinburgh Council: Home composting guide (making great compost): Vermin-prevention advice: keeping cooked/starchy/meat/dairy waste out of the heap, weighing down or covering the lid, and lining the base with fine chicken wire to block vermin while letting worms through

