Nighttime (or nocturnal) leg cramps are a sudden tightening (contraction) of the leg muscles, usually in the calf. But the muscle cramps can sometimes happen in the thigh or foot. They often occur just as a person is falling asleep or waking up. Leg cramps can be painful. They can last a few seconds to a few minutes. Nighttime leg cramps are sometimes called charley horses.
Though nighttime leg cramps are common, experts don't know exactly what causes them.
To stop a leg cramp, while sitting, straighten your leg and bend your foot up toward your knee. It may help to place a rolled towel under the ball of your foot and, while holding the towel at both ends, gently pull the towel toward you while keeping your knee straight. This stretches the calf muscles. The leg cramp usually goes away after a few minutes. Some people find that a hot shower or a warm bath helps. Others get relief by rubbing the calf with an ice pack.