How are some animals able to sleep standing up?

In order to sleep while standing up, you need legs that can be aligned vertically, so you don’t need to use muscular effort to keep them straight. You also need knees that ‘lock’ in place.

Why do some animals sleep standing up?

Sleeping upright is advantageous for large animals that would be slow to lumber to their feet if attacked. If they are already standing it means they can flee quickly from a potential predator. For smaller animals, the reduction in leg springiness outweighs this benefit.

Often these herds will also have one member who serves as a look out and can raise the alarm.

What animals sleep standing up?

Horses, bison, zebras and elephants sleep standing up. Cows can too, but mostly choose to lie down. Giraffes also sleep standing up, but only for short periods of time.

Some birds also sleep standing up. Many birds roost in trees at night using an arrangement of their leg tendons that causes their body weight to pull the claw shut around the branch. Whether this counts as standing up is a matter of semantics.