Most muscle spasms release within seconds to minutes using a combination of stretching, temperature therapy, and over-the-counter pain relief. The approach that works best depends on whether your spasm is an acute cramp happening right now, a recurring problem after exercise, or a chronic pattern tied to an underlying condition. Here’s what actually helps, starting with what to do in the moment.
Stretch Through It Immediately
The fastest way to break an active spasm is to stretch the affected muscle, even though it feels counterintuitive to lengthen something that’s already painfully tight. This is the same approach athletes use when they cramp during a game. You want to gently but firmly stretch into the tightness, holding for 30 to 60 seconds, and progressively increase the range as the muscle releases.
For back spasms, start with the easiest positions first. A child’s pose (kneeling and pushing your hips back toward your heels) is a good entry point. From there, progress to lying on your back and pulling your knees to your chest, then rotational stretches where you let your bent knees fall to one side while keeping your shoulders flat. Do 10 to 15 repetitions per side, going a little further each time. Cat-cow movements on your hands and knees (arching your back up, then dropping it down) also help, aiming for 10 to 20 slow repetitions.
For calf cramps, flex your foot upward toward your shin, either by pulling your toes back with your hand or pressing the ball of your foot against a wall. For hamstring spasms, straighten your leg and lean forward at the hips. The key in every case is the same: hold the stretch through the discomfort, breathe steadily, and let the muscle gradually release rather than trying to force it all at once.
When to Use Heat vs. Cold
Heat and cold therapy both work for spasm-related pain, but they do different things. Heat reduces muscle stiffness and is the better choice when a muscle feels tight, knotted, or chronically sore. A warm towel, heating pad, or warm bath helps the muscle relax and increases blood flow to the area. Use heat for ongoing tightness, soreness after exercise, or spasms not caused by an acute injury.
Cold therapy is better when there’s swelling or inflammation involved. If you pulled or strained a muscle and it’s swollen, ice numbs the area, reduces pain, and limits inflammation. Apply ice wrapped in a towel for 15 to 20 minutes at a time. One important rule from Johns Hopkins Medicine: don’t use heat for the first 48 hours after an injury. During that initial window, cold is the safer choice. After two days, you can switch to heat or alternate between the two.
Over-the-Counter Pain Relief
Anti-inflammatory medications like ibuprofen and naproxen are generally more useful for muscle spasms than acetaminophen. They reduce inflammation throughout the body by blocking the chemical signals that cause swelling and pain, while acetaminophen primarily raises your pain threshold without addressing inflammation. If the spasm involves any tissue irritation or swelling (which most do), an anti-inflammatory gives you more relief.
A joint guideline from the American College of Physicians and the American Academy of Family Physicians recommends topical anti-inflammatory gels as the first choice for acute musculoskeletal pain. These are applied directly to the skin over the painful area and deliver the medication locally with fewer side effects than pills. Oral anti-inflammatories and acetaminophen are listed as effective second-line options. The same guideline specifically recommends against using opioids for this type of pain except in cases of severe injury.
If you’re over 65, use naproxen at lower doses and for shorter periods, as the risk of side effects increases with age. For acetaminophen, the ceiling is 3,000 to 4,000 milligrams per day for adults, and staying at the lower end protects your liver.
Prescription Muscle Relaxants
When spasms are severe enough that stretching and over-the-counter options aren’t cutting it, doctors sometimes prescribe muscle relaxants. These are meant as a short-term addition to rest and physical therapy, not a long-term solution. The most commonly prescribed options include cyclobenzaprine, methocarbamol, and tizanidine.
The main thing to know about muscle relaxants is that drowsiness is essentially universal. They work partly by depressing your central nervous system, which means sedation, dry mouth, and impaired coordination are common across nearly all of them. These medications are considered potentially unsafe for older adults. Some carry risks of dependence and withdrawal with extended use, and mixing them with alcohol or other sedating medications amplifies the side effects significantly. Most doctors prescribe them for a few days to two weeks, not longer.
PNF Stretching for Stubborn Spasms
If you’re dealing with recurring spasms in the same muscle group, a technique called PNF stretching (proprioceptive neuromuscular facilitation) can retrain the muscle to stop seizing up. It works by alternating between contracting and stretching the muscle, which essentially overrides the spasm reflex.
Here’s how it works: have a partner move your limb into a stretched position. While holding that stretch, push against your partner’s resistance (contracting the same muscle you’re trying to stretch) for 7 to 15 seconds. Relax for two to three seconds, then stretch a little further than before. Repeat three to five times. This contract-relax cycle convinces the muscle’s protective reflex to let go, allowing a deeper stretch than passive stretching alone. Physical therapists frequently use this technique for patients with chronic tightness or post-injury spasms.
Does Magnesium Help?
Magnesium supplements are one of the most commonly recommended home remedies for muscle spasms, but the clinical evidence is weaker than most people expect. A meta-analysis of randomized controlled trials in pregnant women, a group particularly prone to leg cramps, found that oral magnesium supplementation did not significantly reduce the frequency of cramps compared to placebo. The supplements were safe, with no notable side effects, but they didn’t deliver meaningful relief.
That said, if you’re genuinely low in magnesium from a poor diet, heavy sweating, or certain medications, correcting the deficiency can help. Foods rich in magnesium include nuts, seeds, dark leafy greens, and whole grains. Whether supplementing beyond correcting a deficiency does anything for spasms remains unproven.
Preventing Spasms From Coming Back
Most isolated muscle spasms are caused by overuse, dehydration, or holding an awkward position too long. Staying hydrated before and during exercise, warming up before intense activity, and stretching regularly all reduce the likelihood of recurrence. If you tend to cramp at night, gentle calf stretches before bed and staying hydrated throughout the evening can help.
Electrolyte balance matters too. Sodium, potassium, calcium, and magnesium all play roles in muscle contraction. If you sweat heavily during exercise or work in hot environments, water alone may not be enough. Adding an electrolyte source helps replace what you lose.
When Spasms Signal Something Serious
Occasional muscle spasms are extremely common and almost always harmless. But certain patterns warrant medical attention. If your spasms are accompanied by muscle weakness, poor coordination, numbness, or skin changes in the affected limb, schedule an appointment with your doctor. Cramps that wake you up at night repeatedly, last unusually long, or come with significant swelling also deserve evaluation.
Call 911 or go to an emergency room if you experience unbearable pain, muscle cramps throughout your entire body, or spasms that started after contact with a potentially poisonous substance. Severe whole-body cramping can indicate a dangerous electrolyte imbalance or an underlying condition like thyroid disease or a neurological disorder that needs immediate attention.

