• Prepped & Ready
  • Posts
  • Compost Pests: How to Keep Rats, Flies, and Raccoons Out of the Bin

Compost Pests: How to Keep Rats, Flies, and Raccoons Out of the Bin

October is when the leaves pile up and the rodents go looking for a warm place to winter. Here's the fix list, pest by pest.

Compost pests article header showing backyard compost bins with wire mesh sides next to a pile of raked autumn leaves

Key points

  • Compost pests are a food and shelter problem. The biggest fix is what you stop putting in: no meat, fish, bones, dairy, fats, oils, or pet waste.

  • A mouse gets through any opening over 1/4 inch and a rat through anything over 1/2 inch, so 1/4 inch hardware cloth is the one mesh that stops both.

  • Burying scraps deep is real fly and odor control, but it doesn't stop a rat, which digs. A hard floor and a tight lid do.

  • A pile holding 130 to 160 degrees F is its own pest control. Fly larvae die above 113 degrees F, and 140 degrees F kills most weed seeds in an hour.

  • Sow bugs, springtails, worms, and black soldier fly larvae aren't compost pests. They're the crew doing the work.

Every October my compost pile doubles. The leaves come down, the tomato vines come out, and the bin goes from half full to heaped in two weekends. That's also the month rats and mice start shopping for a warm place to winter, which is why compost pests peak in fall.

Almost every compost pest problem traces back to three things: what you put in, whether you cover it, and whether the bin has a hard floor and a tight lid. Get those right and the pile goes back to being boring. If you're chasing an odor instead, the three fixes for a smelly compost pile are where to start.

What attracts compost pests in the first place?

Compost pests come for concentrated, exposed, high-protein or high-fat food, and for the dry warm shelter a loose pile provides. Nothing else about decomposing leaves interests a rat.

The EPA's home composting guidance is blunt about the food half. Meat, fish, and bones attract animals. Cheese and dairy attract pests and never fully break down in a backyard pile. Fats, oils, and grease attract animals and resist decomposition. Pet waste adds a pathogen problem. Cornell Cooperative Extension adds leftovers heavy on oil or seasoning.

The shelter half gets skipped. A heap of dry leaves with a warm core is a nest site whether or not food is in it. Cornell's siting advice is to keep the bin away from bird feeders, pet bowls, garbage cans, and brush piles, since those already pull wildlife into the yard. In a survey Cornell cites, pests including rats were the third most common composting obstacle.

How do you keep rats and mice out of a compost bin?

Exclude them with 1/4 inch hardware cloth on every face including the floor, fit a tight lid, and stop adding the foods that bring them. Wire is the one part a rodent can't argue with.

The numbers are worth memorizing. Extension's rodent exclusion guidance says rats use any opening greater than 1/2 inch (1.3 cm) and mice any opening larger than 1/4 inch (0.6 cm). The matching mesh is 19 gauge, 1/2 by 1/2 inch for rats, and 24 gauge, 1/4 by 1/4 inch for mice. Los Angeles County Public Health puts it in one line: openings of 1/4 inch or less exclude both. EPA says the same for compost, recommending a 1/4 inch reinforced bin with a lid where rodents are a problem.

Material matters as much as mesh size. Rodents gnaw plastic, wood, rubber, and vinyl, but not hardware cloth, galvanized metal, cured concrete, brick, or aluminum. Cornell warns that rats chew through a tumbler's plastic vents, so screen them.

For the floor, Cornell gives three options: 1/4 to 1/2 inch galvanized hardware cloth buried under the bin over 3 to 4 inches of coarse gravel, concrete or patio stones, or a pallet lined with wire. Any beats bare soil. If you're building new, the compost bin materials worth building with matter, because that floor is easier to design in than to retrofit.

Rodent resistant compost bin with a tight fitting lid and quarter inch hardware cloth sides on a hard paver base, a key fix for compost pests in fall

A lid, wire on every face, and a hard floor. That combination settles most compost pest arguments before they start.

Now the part most guides skip. Burying food scraps deep doesn't solve a rodent problem. Covering scraps is excellent fly and scent control, and bear-country guidance leans on it hard. But a rat digs for a living. Structural rodent proofing calls for barriers 36 inches below grade, which nobody installs under a compost bin, and that's why the practical answer is a hard floor instead of depth of soil.

The biggest fix isn't hardware at all, though. Wire and lids are the backstop. Pulling meat, bones, grease, and dairy out of your scrap bucket is the fix, and it costs nothing.

One health note, calmly. The CDC says rodents spread many diseases through direct contact, contaminated material, and bites, and carry fleas and ticks besides. LA County says to glove up, use disinfectant, and bag soiled material sealed. Reason enough not to hand-sort a nested pile bare handed.

What about raccoons, opossums, dogs, and bears?

Same fix, heavier hardware. These are lid-and-latch animals, not mesh animals.

Cornell lists rodents, raccoons, and house pets as the groups drawn to compost, and says a secure, tight-fitting lid is essential. Raccoons and opossums want the same scraps rats want, and a raccoon has hands enough to lift a lid you only set on top. Dogs are after bones, grease, and meat, one more argument for the EPA list.

In bear country, treat the pile like your trash and your grill. Vermont Fish and Wildlife says keep meat and bones out entirely, use an enclosed bin lined with wire or an open pile behind electric fencing, and cover all greens with browns. The same agency pulls bird feeders April 1 through November 30, which is how long the bear-active window runs. Early October is inside it.

Why are there flies in my compost, and which ones matter?

Most flies in a compost bin are a cover problem, not an infestation. Fruit flies and house flies mean exposed wet food. Big armored larvae mean black soldier flies, which are fine.

Fruit flies run 1 to 2 mm, and Massachusetts guidance notes they're drawn hard to fruit, bananas above all, and often arrive as eggs already on the fruit you bought. A thin layer of browns over every kitchen dump is the whole fix.

House flies are the ones to take seriously. University of Minnesota Extension reports a female lives 3 to 4 weeks, lays batches of 75 to 100 eggs, breeds in garbage, manure, and decomposing vegetation, and that adults emerge in roughly 7 to 14 days. An uncovered pile can turn over a full generation between turnings, and they carry diarrhea and dysentery organisms. Blow flies are a different signal: they lay on meat-containing garbage, maggots full size by day 2 or 3. If you have them, something went in that shouldn't have.

Black soldier flies are the ones people panic about and should not. Oregon State University Extension describes the larvae as gray-white and about 1 inch long when young, then dark brown, flattened, and torpedo shaped, with no legs. They won't harm you or the compost. They speed decomposition and bring in beneficial bacteria and fungi. If you want fewer anyway: bury kitchen waste under 2 to 4 inches of dry absorbent material, screen the bin's openings so adults can't lay, and let the pile heat, because the larvae can't survive above 113 degrees F.

What do ants, yellowjackets, and cockroaches tell you about the pile?

Each is a reading, not a verdict. Ants read dry, yellowjackets read exposed sugar late in the season, and cockroaches read warm climate plus moist shady clutter.

Ants. Extension's answer is direct: dry conditions in a compost pile encourage invasion by ants. Turn the pile and water it, and they usually move the eggs. The species involved are often moisture ants in the genus Lasius, which nest in decomposing plant material by nature, so a few in a cool corner are normal. A full colony with brood is a moisture gauge telling you the pile is too dry to be composting.

Yellowjackets. University of Kentucky entomology explains the October problem exactly. Colonies reach maturity in late summer and fall with huge numbers of workers foraging, and as insect prey thins they scavenge sweets instead: fruits, soft drinks, anything sugary. Open fruit scraps are a billboard. Kentucky's fix is to keep food covered, use tight-fitting self-closing lids, and pick up fallen fruit. One behavior note: foragers away from the nest seldom sting unless provoked, but a colony is extremely aggressive when the nest is disturbed. Don't turn a pile you suspect holds a nest. Wait for a hard freeze.

Cockroaches. Extension's outdoor roach guidance says outdoor species burrow in moist shady places including compost piles, mulched beds, and leaf litter, mostly in warm climates. The American cockroach reaches about 3 inches. The fix is unglamorous: cut the harborage, keep the pile off the house foundation, seal gaps around doors and windows.

Which compost pests are actually doing the work?

Most of the small crawling things in a maturing pile are decomposers, and getting rid of them slows the compost down.

NC State Extension's composting organisms sheet lists earthworms, nematodes, springtails, centipedes, mites, spiders, ants, snails, sow bugs, and slugs, and explains their job: they increase microbial populations by making organic matter more available as they forage. Sow bugs shred coarse material into pieces bacteria can use, springtails eat fungi, and centipedes and spiders keep the rest in balance.

The honest limit: a decomposer in the pile can be a nuisance in the garden. Slugs move from finished compost into seedlings, and sow bugs sometimes chew soft stems. That's a plant problem with a different answer, starting with identifying the garden pest before you treat it.

Finished compost with sow bugs and an earthworm in dark crumbly material under a layer of dry brown leaves, the beneficial organisms people mistake for compost pests

Sow bugs, worms, and springtails in finished compost aren't an infestation. They're what a working pile looks like.

What makes a compost bin unattractive to pests in the first place?

Build a pile that heats, stays as damp as a wrung-out sponge, and gets covered every time you add food. A pile doing its job isn't comfortable for most pests.

  • Carbon to nitrogen. The Cornell Waste Management Institute target is 30 to 1 by weight; Texas A and M AgriLife Extension allows 25 to 1 through 40 to 1. Nobody weighs this at home, so use EPA's volume rule: at least two to three times as much browns as greens. In October that's free, because the browns are on your lawn.

  • Moisture. Cornell specifies 40 to 60 percent; EPA's field test is the wrung-out sponge. Too dry brings ants and no heat; too wet brings odor and flies.

  • Air and turning. Cornell wants oxygen above 10 percent, Texas A and M says 5 percent minimum. Minnesota Extension's home schedule is turning once or twice a month, when the center cools.

  • Size. University of Minnesota Extension says 3 to 5 feet in each direction. Smaller won't hold heat; larger blocks air and water from the middle.

  • Heat. An active pile runs 130 to 160 degrees F, and Texas A and M reports 131 to 170 degrees F within 1 to 3 days when conditions are right.

That heat does more than you think. Texas A and M's data shows that at 140 degrees F, 90 percent of the seeds of several common weeds die in under an hour, at 115 degrees F the same species can take 12 to 268 hours, and at 108 degrees F several are unaffected. The catch: the pile must be mixed thoroughly so all of it spends time in the hot zone. A hot core with a cool edge means the edge is where weed seeds and fly larvae survive. That's the real argument for turning.

Keep these out, always: meat, fish, bones, dairy, fats, oils, grease, lots of cooked food, pet waste, and cat litter. Minnesota adds diseased plants and weeds gone to seed, because a home pile may not heat evenly enough to decontaminate them. If your scrap stream is heavy on things that do not belong in an open pile, rethink the system rather than the lid.

Frequently asked questions

Will burying food scraps keep rats out of my compost?

No, not on its own. Burying scraps under browns is excellent fly and odor control, and Cornell and Oregon State both recommend it. But rats dig. Exclusion depends on hardware: a 1/4 inch wire floor or hard surface under the bin, wire sides, a tight lid.

Are maggots in my compost a problem?

Usually not. Large, flattened, dark brown, torpedo-shaped larvae about an inch long are black soldier fly larvae, which Oregon State Extension says won't harm you or the compost. Smaller pale maggots in meat-smelling material are likelier blow flies.

What size hardware cloth keeps rodents out of a compost bin?

Use 1/4 inch. Mice get through anything over 1/4 inch and rats anything over 1/2 inch, so it's the one size that excludes both. EPA recommends a 1/4 inch reinforced bin with a lid.

Do I have to stop composting in fall because of rodents?

No. Fall is the easiest season to run a clean pile, because leaves give you unlimited browns for burying scraps and for hitting EPA's 2 to 3 parts browns per part greens. What changes is urgency: rodents want winter shelter, so October is the month to fix the lid and the floor.

Can I compost eggshells and coffee grounds without attracting pests?

Yes. Coffee grounds are a green with no meaningful pest draw, and EPA lists them with crushed eggshells as compostable. Cornell notes some composters find eggshells attract animals, probably from leftover residue, so rinse, crush, and bury them.

The numbers, in one place

Item

Figure

Source

Opening a mouse can pass

Larger than 1/4 inch (0.6 cm)

Extension wildlife damage management

Opening a rat can pass

Greater than 1/2 inch (1.3 cm)

Extension wildlife damage management

Mesh that excludes both

1/4 inch or smaller

LA County Public Health, EPA

Hardware cloth gauge

24 gauge for mice, 19 gauge for rats

Extension wildlife damage management

Gravel plus wire bin floor

3 to 4 inches gravel under 1/4 to 1/2 inch galvanized cloth

Cornell Cooperative Extension

Carbon to nitrogen ratio

30 to 1 target, 25 to 1 through 40 to 1 workable

Cornell, Texas A and M

Browns to greens by volume

At least 2 to 3 times more browns

EPA

Moisture

40 to 60 percent, wrung-out sponge

Cornell, EPA

Oxygen

Above 10 percent (5 percent minimum)

Cornell, Texas A and M

Pile size

3 to 5 feet in each direction

Minnesota Extension

Active pile temperature

130 to 160 degrees F; 131 to 170 degrees F in 1 to 3 days

EPA, Minnesota, Texas A and M

Weed seed kill

140 degrees F kills 90 percent in under 1 hour; 115 degrees F takes 12 to 268 hours

Texas A and M

Soldier fly larvae die above

113 degrees F

Oregon State Extension

Bury scraps under

2 to 4 inches of dry absorbent material

Oregon State Extension

House fly egg to adult

About 7 to 14 days; 75 to 100 eggs per batch

Minnesota Extension

Turning frequency

Once or twice a month

Minnesota Extension

Bear-active window

April 1 through November 30

Vermont Fish and Wildlife

Go look at your bin this weekend. Check the lid closes, check what the floor sits on, and check whether the last bucket of scraps is still showing. Three minutes now beats a trap line in January.

You never know, but you can always be ready.

Sources: EPA, Composting at Home; Cornell Cooperative Extension, Composting: Preventing Animal Nuisances; Cornell Waste Management Institute, The Compost Process; Extension Wildlife Damage Management, Rodent Exclusion Methods; Los Angeles County Public Health, Are You Attracting Rats and Mice to Your Yard?; CDC, About Rodents; University of Minnesota Extension, Composting in Home Gardens; University of Minnesota Extension, Flies; Texas A and M AgriLife Extension, Composting to Kill Weed Seeds; Oregon State University Extension, Soldier Fly Larvae; University of Kentucky Entomology, Foraging Yellowjackets; Ask Extension, Ants in Compost; Vermont Fish and Wildlife, Safe Composting in Bear Country; Extension Pests in the Home, Outdoor Cockroaches; NC State Extension, Composting Microorganisms; Massachusetts, Flies and Gnats.