Snakes living in deserts subsist on the same type of prey most other snakes do, including lizards, rodents, birds and invertebrates. As predators, snakes cannot colonize desert habitats unless there is ample prey to meet their needs.
All of the major terrestrial snake lineages include species that live in deserts. Vipers and pit vipers, such as horned adders and sidewinders, are ambush hunters that primarily consume lizards and rodents. Like vipers and pit vipers, boas and pythons living in deserts are usually ambush hunters, who kill their prey by constriction. They are usually opportunistic predators that consume any prey that they can catch, but some species specialize on a specific type of prey. For example, sand boas of Middle Eastern deserts primarily eat rodents, while desert-dwelling pythons, such as blackhead pythons, prefer lizards. Other snakes of the desert concentrate on smaller prey. Black-headed snakes primarily consume arthropods, such as insects, centipedes and scorpions.
Snakes have evolved many different adaptations that allow them to capture food in the deserts. Some species burrow into the soil to avoid being detected by their prey. This behavior provides a secondary benefit to the snakes, as the sand protects them from the hot sun. Some burrowing snakes have their eyes located on the tops of their heads to enable them to see well while they are partially covered by sand.