Exercise is crucial if you have arthritis. But knowing just how much activity to do when you’re hurting can be tricky. Although mild muscle soreness after a workout is normal, sharp pain during or immediately after can signal injury.

We talked to physical therapist Richard Kassler, supervisor at the Orthopaedic and Sports Therapy Center at New York University Hospital for Joint Diseases, in New York City, and rheumatologist James O’Dell, MD, president of the American College of Rheumatology Research and Education Foundation, in Atlanta, to get guidelines for when it’s OK for people with arthritis to work through exercise pain – and when it is not:

If you have moderate to severe pain in a specific joint area before you work out:
Focus on a different area for a day or two. If your knees hurt, skip the lower-body strength training routine, and work your upper body  instead. “Continuing to put pressure on a joint when it’s especially sore could contribute to joint damage, so it’s best to ease up for a while,” says Kassler.

If you have moderate to severe joint pain during exercise:
Stop immediately. “Most people with arthritis can work through mild pain safely. But if you’re experiencing a lot of pain while you exercise, even if you’re not doing a particularly joint-taxing workout, it may be a sign that you have inflammation in the joint, or even joint damage that requires treatment,” says Kassler.

If you consistently have joint pain (not muscle pain) after exercise:
Switch to a workout that puts less pressure on your joints. “If you need an elaborate brace or have to pop ibuprofen constantly, it’s a pretty good sign that your activity is too hard on your joints,” says Dr. O’Dell. Swimming, water aerobics and biking are all good options for people with joint pain.

If you occasionally have moderate to severe joint pain the day after you work out: 
Cut back on the intensity of your workout. “If you’re really sore the next day, you probably were exercising too hard or too long,” says Dr. O’Dell. He suggests taking a day off, then doing a shorter, less strenuous workout. If your pain still doesn’t let up, switch to a less intense form of exercise, such as trading your elliptical workout for water aerobics.