Rats, flies, and ants in the compost

Pests in the compost are annoying, but they’re also information. Each one is drawn to a different condition, so the pest you’re seeing tells you a fair amount about what’s going on inside the heap.

Quick fix

Rats

Rats want two things from a compost heap: food and shelter. A carelessly run heap offers both. The biggest single draw is exposed food waste, especially anything that shouldn’t be in the heap in the first place — meat, dairy, cooked food (see the guide on what not to add). But even appropriate scraps like vegetable peelings attract rats when they sit on the surface rather than being mixed into the pile.

The fix starts with what goes in and how. Bury fresh scraps under a layer of existing material or browns, and cut out meat, dairy, and cooked food entirely. Then look at the base, because burrowing up from below is often how rats get established: wire mesh under an open heap, or a bin with a closed or mesh bottom, shuts off that route. If your bin has a lid, check that it closes properly. Rats are persistent, and they will find a gap.

Fruit flies

Small flies hovering around the heap, especially near the surface, are almost always fruit flies, drawn to exposed fresh fruit and vegetable scraps. They’re a nuisance more than a genuine problem — they don’t damage the compost or attract larger pests on their own — but a swarm of them is unpleasant anywhere near where you sit or hang washing.

The fix is burial. A few inches of existing compost, or a scattering of browns over each new addition, is usually enough to stop the flies reaching the scraps to lay eggs. If you’re adding scraps often, keep a small covered container in the kitchen and empty it into the heap every couple of days, burying each load as it goes in.

Ants

Ants turning up in numbers usually mean one specific thing: the pile has gone too dry. Ants prefer dry, undisturbed ground, and a moist, actively decomposing heap is too damp and too busy for them to nest in. Confirm it with the squeeze test from the too-dry guide — grab a handful from the middle and squeeze; if it crumbles apart without holding together, that’s your answer.

Rewet the pile in layers as you turn it, not just poured on top, and get decomposition active again. The ants usually move on within a week or two, once the conditions that suited them are gone. Here the pest is doing you a favour: without the ants, you might not have noticed the pile had dried out and stalled.

The general pattern

The pattern holds across all three: pests show up when a heap offers something a well-run heap doesn’t — food on the surface, a way in at the base, dry undisturbed ground. Bury scraps, secure the base, keep the moisture and activity where they should be, and the large majority of pest problems solve themselves without anything beyond the heap itself. If a serious rat problem persists despite all of that, look at the location. A heap tight against a fence, or beside a shed with existing rat activity, has a problem that no amount of compost management will fix on its own.

Related