What to Take for Muscle Spasms: OTC and Rx Options

Most muscle spasms respond to a combination of simple home treatments: gentle stretching, applied heat, and staying hydrated with adequate electrolytes. For spasms that keep coming back or interfere with sleep, specific supplements and prescription medications can help, though the evidence behind each option varies considerably.

Heat, Ice, and Stretching

The fastest way to ease an active muscle spasm is to gently stretch the affected muscle and hold it in a lengthened position until the contraction releases. For a calf cramp, that means pulling your toes toward your shin. For a back spasm, slowly folding forward or lying on your back with your knees pulled to your chest can help.

Once the acute contraction passes, heat is generally more useful than ice for spasm-related pain. Heat raises your pain threshold and relaxes muscles, and moist heat (a warm, damp towel or a heated water bottle wrapped in cloth) works particularly well. The goal is to raise tissue temperature enough to loosen the muscle without burning your skin, so 15 to 20 minutes at a time is a reasonable window. Ice is better suited for swelling and acute injuries. It reduces inflammation, constricts blood vessels, and numbs the area, but it won’t relax a tight muscle the way heat does.

Electrolytes and Hydration

Your muscles depend on a balance of sodium, potassium, calcium, and magnesium to contract and relax properly. When any of these electrolytes drops too low, your muscles can misfire, producing cramps or sustained spasms. This is why spasms often strike after heavy sweating, vomiting, diarrhea, or long periods without drinking enough fluids.

If your spasms tend to show up after exercise or on hot days, an electrolyte drink or even a pinch of salt in water can help. Potassium-rich foods like bananas, potatoes, and avocados support nerve and muscle signaling. Calcium from dairy, leafy greens, or fortified foods plays a role in how muscles contract. Addressing dehydration is often the single most effective thing you can do for recurring exercise-related spasms.

Magnesium Supplements

Magnesium is the supplement most commonly recommended for muscle spasms, but the clinical evidence is more nuanced than the marketing suggests. A large systematic review of 11 randomized controlled trials covering 735 patients found no overall reduction in leg cramps from magnesium supplementation. Across five studies, magnesium reduced cramp frequency by less than 0.2 cramps per week compared to placebo, a difference that wasn’t statistically meaningful.

There is one notable exception. A 2021 placebo-controlled trial of 184 people taking 226 mg of magnesium oxide daily found a significant drop in cramp frequency after 60 days of consistent use. Participants went from about 5.4 cramps per week down to 1.9, while the placebo group only dropped from 6.4 to 3.7. Cramp duration also fell dramatically in the treatment group. The key detail: this benefit only appeared after two months. Short courses under 60 days consistently fail to show results in clinical trials.

So if you want to try magnesium, commit to at least two months before judging whether it’s working. Magnesium oxide and magnesium citrate are the most common forms. Loose stools are the main side effect at higher doses.

Vitamin B Complex

There’s limited but intriguing evidence for B vitamins. A study published in the journal Neurology found that a vitamin B complex containing 30 mg of vitamin B6 daily induced remission of muscle cramps in 86% of treated patients who weren’t known to be deficient in B vitamins. Based on this and similar findings, the American Academy of Neurology classified vitamin B complex as “possibly effective” for muscle cramps, a cautious endorsement that reflects the small study size. It’s a low-risk option worth trying alongside other approaches, particularly if your diet is limited or you suspect you may not be getting enough B vitamins from food.

Over-the-Counter Pain Relief

Standard anti-inflammatory medications like ibuprofen or naproxen won’t stop a spasm from happening, but they can reduce the soreness that lingers after a severe cramp. If you wake up with a charley horse and your calf aches for hours afterward, an anti-inflammatory can take the edge off that residual pain. These medications don’t address the underlying muscle contraction itself, so they work best as a complement to stretching and heat rather than a standalone treatment.

Prescription Muscle Relaxants

If your spasms are frequent, severe, or tied to a condition like a back injury or neurological disorder, your doctor may prescribe a muscle relaxant. These fall into two broad categories. Antispastic medications act on skeletal muscles, the ones you use to move your body. Antispasmodic medications target smooth muscles inside your organs. For the kind of spasms most people search about (leg cramps, back spasms, neck tightness), antispastic drugs are the relevant category.

Most prescription muscle relaxants work by depressing your central nervous system, which reduces nerve signaling to muscles but also causes significant drowsiness. Common side effects include fatigue, dizziness, nausea, dry mouth, and headache. More serious reactions like fainting and blurred vision can occur. These medications interact dangerously with alcohol, since both are central nervous system depressants. Combining them can cause extreme dizziness, dangerously low blood pressure, memory problems, and increased overdose risk.

Because of the sedation they cause, muscle relaxants are typically prescribed for short-term use, often just a week or two during an acute flare-up. They’re generally not a good long-term solution, and the drowsiness makes driving or operating machinery risky while you’re taking them.

When Spasms Signal Something Deeper

Most muscle spasms are harmless, especially the leg cramps that strike at night or during exercise. But certain patterns warrant medical attention. Spasms in your arms or trunk (rather than your legs) are more likely to reflect an underlying electrolyte, hormonal, or neurological issue. Muscle twitching that happens alongside spasms, weakness or loss of sensation in the affected area, and spasms that follow significant fluid loss from vomiting, diarrhea, or heavy sweating all raise the concern level.

If widespread cramping is paired with overactive reflexes, doctors typically check blood sugar, electrolyte levels (including calcium and magnesium), and kidney function. When muscle weakness accompanies the spasms, electrical testing of the muscle or MRI of the brain and spinal cord may be needed to rule out nerve or neurological problems. Isolated leg cramps that happen a few times a month and respond to stretching rarely need this kind of workup, but spasms that are getting worse, spreading to new areas, or accompanied by weakness are worth investigating.