That's a great question, and one that frustrates a lot of homeowners! To really discourage persistent diggers like raccoons, dogs, or even clever crows, depth is your best friend. The key isn't just about overall bin height, but specifically about how deep the *buried or anchored section* is.
For most common pests, your bin should be situated so that at least 12 to 18 inches of its structure is underground or otherwise inaccessible. Raccoons, with their dexterous paws, are less likely to bother if they can't easily tip the bin over or reach the bottom to claw through bags. Burying a portion of a permanent bin or using an anchored enclosure creates a significant barrier.
However, depth alone isn't always enough for the most determined animals. Pair a deep setup with other deterrents: use a bin with a tight, locking lid, secure it to a post or wall with a bungee cord, and avoid putting overly smelly food waste directly in the outer bin. The goal is to make the effort required far greater than the potential reward. For urban areas with serious raccoon problems, opting for a certified bear-resistant bin, which often has complex latching mechanisms, is the most foolproof solution—depth combined with superior security.