What’s going on?

Muscle cramps happen when a muscle involuntarily contracts on its own. Usually, you feel a hard lump at the point of pain — that’s the contracted muscle. Cramps usually occur for a reason. If you haven’t strained a muscle, you’re probably cramping because your muscle is fatigued or overused, because your body is dehydrated, or because you’re not getting enough electrolytes, such as potassium or magnesium. Those minerals help your muscles work more smoothly, and fluids help your body process the minerals.

Most cases of muscle cramps do not indicate a worrisome underlying condition. People who are 65 and older are at greater risk for them. Cramps might be related to alcoholism, hypothyroidism, or diabetes. If the frequency of your cramps bothers you, tell your doctor.

Meanwhile, there are several remedies you can try yourself.

Stretching

Relax the cramping muscle. Stop any activity that may have induced the cramp and lightly stretch the muscle, gently holding the stretch. You may even massage the muscle while you stretch or after you finish. Consider applying a heating pad to the area, as described below, after stretching. If your calf muscle cramps in the middle of the night, stand up and slowly put weight on the affected leg to push the heel down and stretch out the muscle.

Magnesium

“My first recommendation for patients coming in with leg cramps is magnesium,” says Sarah Thompson, a doula and acupuncturist at Sacred Vessel Acupuncture. Magnesium has been suggested for treating pregnant women’s muscle cramps, but more studies are needed. Talk to your doctor before taking any magnesium supplements if you’re pregnant.

If you regularly have leg cramps that are not related to a more serious condition, you might try adding more magnesium to your diet. Nuts and seeds are excellent sources of magnesium.

Hot soak

Many professionals like personal trainers, coaches, and physical therapists also recommend using magnesium on the outside of your body in the form of Epsom salts. You can find a great selection online. This old-school remedy can be applied to a wet cloth and pressed onto a cramped muscle, or you can add some to a hot bath for a soak.

In fact, a hot soak provides relief for many, with or without Epsom salts. Dry heat may even help. “If you’re not near a bathtub, grab a heating pad,” says certified personal trainer Shane Allen. There are a variety of options available online. Start the pad on the lowest setting and only increase heat if you’re not getting any soothing at all. If you have diabetes, a spinal cord injury, or another condition that might prevent you from feeling heat, a heating pad is not a good option.

Hydration

Another possible way to stop leg cramps is to hydrate. It might take a little longer to address your pain, but once you’ve had water or a sports drink with electrolytes, you could prevent another cramp.

Get moving

“If you are experiencing leg cramps, the best thing that you can do is walk around,” says certified personal trainer Henry Halse. “This will send the signal that your muscle needs to contract and then relax. Think of it as hitting the reset button on the muscle.” If all else fails, and you continue to have regular muscle cramps, Halse advises getting regular massages, which is a nice idea whether you have muscle cramps or not.

Healthline and our partners may receive a portion of revenues if you make a purchase using a link above.