Whether you call them cramps, stitches, or just pains in the butt, muscle spasms put a serious damper on any workout—especially considering they usually strike without warning.

No one is immune to muscle cramps. Your calf muscles, hamstrings, quads, arms, and abs are most likely to be affected. There are plenty of possible culprits too, including being dehydrated, having poor blood circulation, not stretching enough, or just fatiguing your muscles. The news only gets worse: Cramps can occur up to six hours after exercising (talk about a sneak attack!); the notorious charley horse often happens in the middle of the night—and you thought nightmares were bad. Luckily, scientists have found things you can do to prevent and stop muscle cramps in their tracks

Prevent Cramps

  • Jump around. When small nerves in our muscles get fatigued, cramping can occur. Luckily, jumping drills (a.k.a. plyometrics) keep these nerves from tiring. Do them a few times a week after working out to help prevent spasms.
  • Warm up and cool down. A proper warm-up and cool-down, including plenty of stretching, can keep cramps at bay. So make sure to carve out time to get your body moving before working out and relax your muscles once you’re done.

Treat Cramps

  • Stretch the spot. Once the spasms start, stop, drop, and streeetch. Or treat yo’self with a massage to really hit the knot.