One fine day, when Charles Darwin was still  a student at Cambridge, the budding naturalist tore some old bark off a tree and found two rare beetles underneath. He’d just taken one beetle in each hand when he spotted a third beetle. Stashing one of the insects  in his mouth for safekeeping, he reached for the new specimen – when a sudden spray of hot,  bitter fluid scalded his tongue. Darwin’s assailant  was the bombardier beetle. It’s one of thousands of animal species, like frogs, jellyfish, salamanders, and snakes, that use toxic chemicals  to defend themselves – in this case, by spewing poisonous liquid  from glands in its abdomen. But why doesn’t this caustic substance, ejected at 100 degrees Celsius, hurt the beetle itself? In fact, how do any toxic animals  survive their own secretions? The answer is that they use one  of two basic strategies: securely storing these compounds or evolving resistance to them. Bombardier beetles use the first approach. They store ingredients for their poison  in two separate chambers. When they’re threatened, the valve  between the chambers opens and the substances combine  in a violent chemical reaction that sends a corrosive spray  shooting out of the glands, passing through a hardened chamber that protects the beetle’s internal tissues. Similarly, jellyfish package  their venom safely in harpoon-like structures  called nematocysts. And venomous snakes store their flesh-eating, blood-clotting compounds in specialized compartments that only have one exit: through the fangs  and into their prey or predator. Snakes also employ the second strategy: built-in biochemical resistance. Rattlesnakes and other types of vipers manufacture special proteins that bind and inactivate venom  components in the blood. Meanwhile, poison dart frogs have also evolved resistance to their own toxins, but through a different mechanism. These tiny animals defend themselves  using hundreds of bitter-tasting compounds called alkaloids that they accumulate from consuming  small arthropods like mites and ants. One of their most potent alkaloids  is the chemical epibatidine, which binds to the same receptors  in the brain as nicotine but is at least ten times stronger. An amount barely heavier than  a grain of sugar would kill you. So what prevents poison frogs  from poisoning themselves? Think of the molecular target  of a neurotoxic alkaloid as a lock, and the alkaloid itself as the key. When the toxic key slides into the lock, it sets off a cascade of chemical  and electrical signals that can cause paralysis, unconsciousness, and eventually death. But if you change the shape of the lock, the key can’t fit. For poison dart frogs and many other animals with neurotoxic defenses, a few genetic changes alter the structure of the alkaloid-binding site just enough to keep the neurotoxin  from exerting its adverse effects. Poisonous and venomous animals aren’t the only ones that can develop  this resistance: their predators and prey can, too. The garter snake, which dines  on neurotoxic salamanders, has evolved resistance  to salamander toxins through some of the same genetic changes  as the salamanders themselves. That means that only the most toxic  salamanders can avoid being eaten— and only the most resistant snakes will survive the meal. The result is that the genes providing  the highest resistance and toxicity will be passed on in greatest quantities  to the next generations. As toxicity ramps up, resistance does too, in an evolutionary arms race  that plays out over millions of years. This pattern appears over and over again. Grasshopper mice resist painful  venom from scorpion prey through genetic changes  in their nervous systems. Horned lizards readily  consume harvester ants, resisting their envenomed sting  with specialized blood plasma. And sea slugs eat jellyfish nematocysts, prevent their activation  with compounds in their mucus, and repurpose them for their own defenses. The bombardier beetle is no exception: the toads that swallow them can tolerate the caustic spray  that Darwin found so distasteful. Most of the beetles  are spit up hours later, amazingly alive and well. But how do the toads  survive the experience? That is still a mystery.