As unprecedented heat waves become more common, exercisers increasingly have to weigh the joys versus the risks of an outdoor workout.

There’s no simple answer to the question of how hot is too hot. A person’s ability to stay safe while exercising in the heat depends on many factors, like age, usual exercise routine, workout environment and intensity and whether that person is used to being active in the heat, said Stavros Kavouras, director of the Hydration Science Lab at Arizona State University.

Exercising in humid heat poses unique challenges, he said, but being active in dry heat can be just as risky. (If you’re exercising in humid heat, here’s a guide.)

Even when you’re at rest, your body produces heat — and the amount increases as your muscles burn fat and carbohydrates when you exercise. The harder you work, the hotter your body gets.

If the temperature outside is greater than 90 degrees or if the sun is shining, your body will also be heated by the environment, Dr. Kavouras said. (Although the body’s average internal temperature is 98.6, skin often hovers around 90, so temperatures higher than that will increase your risk of overheating.)

“As you’re adding this huge external heat source, the body’s got to deal with that,” said Glen Kenny, a physiologist who studies the body’s stress response at the University of Ottawa.

The main way the body sheds heat is through the evaporation of sweat, which cools the surface of the skin, Dr. Kavouras explained. This happens more easily in dry heat than in humidity, but in dry heat, sweat can evaporate so quickly that you may not notice it.

“You don’t even see it and you don’t even know that you’re getting so dehydrated,” Dr. Kavouras said.

During high-intensity exercise, most people lose one and a half to two liters of water per hour, though some people can lose even more. As a person becomes dehydrated, sweat production slows and it becomes harder to cool off. Some people are better at dissipating the heat than others. Those who exercise less regularly, who aren’t used to the heat, are sleep-deprived, are sick or are older have more trouble cooling off, which puts them at increased risk for heat-related illnesses, Dr. Kenny said.

People can, to a limited degree, acclimate to exercising in the heat, he added. In a small 2019 study, healthy men between 50 and 70 improved their ability to dissipate heat by 5 percent after a week of exercising daily in 104-degree temperatures. But it’s unclear how much people following a more relaxed regimen will acclimatize, he said.

Try to exercise during the coolest time of the day, which is often the early morning in dry heat regions, said Dr. Jill Tirabassi, a physician with expertise in sports medicine at the University at Buffalo. Seek out shade and wear porous, light-colored clothing made of a moisture-wicking material. The more bare skin the better.

Avoid cotton, which holds onto water rather than allowing it to evaporate, and backpacks, because you produce a lot of sweat around your spine that can get trapped, Dr. Kavouras said.

If you exercise and start to feel unwell, stop, rest in the shade and remove excess clothing, Dr. Tirabassi said. “Warning signs can be subtle at times,” she said, but symptoms of heat-related illness can include cognitive or mood changes, rapid pulse, headache, tunnel vision, dizziness, fainting or nausea.

Feeling cold or developing goose bumps are clear signs of a medical emergency, Dr. Kavouras said. Cool down by drinking cold fluids, spraying yourself with water, covering yourself with a cold towel or taking a cold shower. Work out with a partner in case one of you starts to feel sick.

Even if you don’t feel yourself sweating as you exercise, drink lots of water, Dr. Kenny said. “Water is always the most important thing,” he said. The most you want to drink is about 1.5 liters of water an hour, which is the body’s absorption limit, Dr. Kavouras said.If you plan to do high-intensity exercise in the heat for over an hour, consider a hydration drink with added electrolytes — minerals such as sodium, potassium and magnesium that are released while sweating — to replace what you lose, Dr. Kavouras said. Otherwise, you can experience cramping, dizziness and become prone to fainting, he said.

Sodium is especially important. “If you’re an athlete, especially if you exercise in a hot environment and you sweat profusely, you do need a lot,” he said. If nothing else, on days when you exercise at high intensity for over an hour, “it is a good idea to salt your food a little bit more.”

If you exercise in the high heat and your body isn’t used to it, be sure to give yourself ample time to rest between workouts, too. Consider not exercising every day.

“If you push your body day after day, there is a progressive deterioration in your body’s ability to dissipate heat,” Dr. Kenny said. “Your body needs to recover.”