You’ve just dropped a heavy object on your toe. Or you’ve just learned that a project on which you were working day and night has been canceled. Or you’ve just rounded a bend on a tough hike and discovered that the trail gets even steeper and rockier up ahead.

What do you do? Do you grit your teeth and say nothing? Do you express yourself with politeness and clarity, saying something like, “Well, this is really disappointing.” Or do you let loose with a bunch of four-letter expletives?

You’ve just dropped a heavy object on your toe. Or you’ve just learned that a project on which you were working day and night has been canceled. Or you’ve just rounded a bend on a tough hike and discovered that the trail gets even steeper and rockier up ahead.

What do you do? Do you grit your teeth and say nothing? Do you express yourself with politeness and clarity, saying something like, “Well, this is really disappointing.” Or do you let loose with a bunch of four-letter expletives?

Believe it or not, the third of these options is the one with the most brain benefits. In her new book, Swearing Is Good for You: The Amazing Science of Bad Language, British science writer Emma Byrne recounts multiple experiments that show just why using really bad language can be really good for you. Research has already shown that people who swear are generally more honest than those who don’t. Now we also know that people who swear may be helping themselves when they do it.

Here’s how cursing can make you feel better:

1. It lessens pain.

An experiment repeated many times has consistently shown that swearing makes you able to withstand discomfort better than not swearing. The way they proved this was by having experimental subjects hold their hands in painfully icy water for as long as they could stand it, while either saying curse words or neutral words. Those who were cursing while holding their hands in the water were able to keep their hand in about 50 percent longer than those who were saying neutral words. Byrne tried the experiment on herself and found that she was able to keep her own hand in cold water longer when swearing as opposed to saying affirmative things such as “Emma, you can do it.”

Why does swearing make you more pain-tolerant? It turns out that using curse words causes actual physiological changes in your body, such as a heightened heart rate. They are basically the same sorts of changes that come about in a heightened emotional state–swearing appears to unleash the fight-or-flight response. Being able to ignore pain in a situation where you have to either go into battle or run for your life is obviously an advantage, which is likely why our brains and bodies evolved this way.

2. It helps us avoid actual violence.

To help understand the purpose of swearing in human interactions, Byrne took a look at what happened when a family of chimpanzees were taught sign language by human researchers. Chimps are humans’ nearest living relative, and in the wild they often throw their own feces as a way to express anger or territoriality.

For obvious reasons, the very first task for researchers working with new chimp subjects is to train them out of this behavior. So it’s fascinating to note that research chimps who’ve been taught not to throw poop at others naturally begin making the sign for poop instead when they’re ticked off–using profanity exactly the same way we do.

Byrne hypothesizes that human swearing evolved the same way. Living in social groups as both humans and chimps do, it can be a seriously bad idea to let loose and throw a punch at someone who’s made us angry. So, just like the chimps, we use swear words instead, letting profanity stand in for aggressive action. No wonder it causes a similar physical response.

3. Swearing can help you achieve more.

Swearing is one activity that engages both sides of your brain, the language center in the left brain and the emotional center in your right brain. This may be why people who have trouble speaking, such as stroke victims or stutterers, are often able to speak more easily when they curse.

Psychologist Richard Stephens, who devised the hand-in-ice-water experiment, did a follow-up study to see whether saying a swear word would help people when making a physical effort. In this case, subjects either did a 30-second cycling challenge or a grip strength test. In both cases, saying a swear word, even though they were instructed to say it in an even, neutral tone, increased their strength measurably. (It didn’t, however, increase their heart rates, suggesting that in this case the fight-or-flight response was not triggered.) Whatever the reason, next time you face a physical challenge and you feel like swearing, go right ahead. It will help you power through.