Know your opponent
Raccoons have dexterous front paws that work like hands, they can lift 20+ pounds, they remember solutions, and they teach their young. A raccoon that's defeated your trash can once will defeat it faster next time. This isn't a pest you discourage with a mild inconvenience — you need a system that actually holds.
What doesn't work
Bungee cords. Raccoons chew through them or work them loose; they're a speed bump, not a lock. Heavy rocks or bricks on the lid. A determined raccoon tips the can over and works the lid from the ground. Mothballs or ammonia. Ineffective, and mothballs are regulated pesticides that shouldn't be scattered around. Yelling at them. Satisfying, useless.
What actually works
Locking-lid cans. Cans with built-in locking mechanisms or twist-lock lids are the real answer — raccoons can't get leverage on a lid that latches on multiple sides. Timing. Put cans out the morning of pickup, not the night before. A can that sits out for 3 hours is a much smaller target than one sitting out for 14. Clean the cans. Hose them out regularly; the food residue coating the inside is an advertisement. Double-bag smelly trash and freeze meat scraps until pickup day if you're serious.
When trash raiding means a bigger problem
Nightly trash raids often mean a raccoon is denning nearby — under a shed, in a storm drain, in your attic. If you're locking the cans and still seeing raccoon sign (droppings, tracks, tipped recycling), look for the den. And if the raiding is paired with attic noises, the trash is just the commute — the home is the attic. Read about raccoon removal.