Anti-predator adaptations are mechanisms developed through evolution that assist prey organisms in their constant struggle against predators. Throughout the animal kingdom, adaptations have evolved for every stage of this struggle.
The first line of defence consists in avoiding detection, through mechanisms such as camouflage, living underground, or nocturnality. Alternatively, prey animals may ward off attack, whether by advertising the presence of strong defences in aposematism, by mimicking animals which do possess such defences, by startling the attacker, by signalling to the predator that pursuit is not worthwhile, by distraction, by using defensive structures such as spines, and by living in a group. Members of groups are at reduced risk of predation, despite the increased conspicuousness of a group, through improved vigilance, predator confusion, and the likelihood that the predator will attack some other individual.
Some prey species are capable of fighting back against predators, whether with chemicals, through communal defence, or by ejecting noxious materials. Many animals can escape by fleeing rapidly, outrunning or outmanoeuvring their attacker. Finally, some species are able to escape even when caught by sacrificing certain body parts: crabs can shed a claw, while lizards can shed their tails, often distracting predators long enough to permit the prey to escape.
Animals may avoid becoming prey by living out of sight of predators, whether in caves, underground, or by being nocturnal. Nocturnality is an animal behavior characterized by activity during the night and sleeping during the day. This is a behavioral form of detection avoidance called crypsis used by animals to either avoid predation or to enhance prey hunting. Predation risk has long been recognized as critical in shaping behavioral decisions. For example, this predation risk is of prime importance in determining the time of evening emergence in echolocating bats. Although early access during brighter times permits easier foraging, it also leads to a higher predation risk from bat hawks and bat falcons. This results in an optimum evening emergence time that is a compromise between the conflicting demands. Another nocturnal adaptation can be seen in kangaroo rats, which exhibit moonlight avoidance. These rodents forage in relatively open habitats and reduce their activity outside their nest burrows in response to moonlight. During a full moon, they shift their activity towards areas of relatively dense cover to compensate for the extra brightness. In controlled experiments, artificial moon-like illumination stimulates similar responses in their foraging behavior, suggesting that this behavior has evolved to reduce predation risk.