People masturbate for pleasure, to relax, to fall asleep, and to ease stress and anxiety. Orgasms look the same in the brain for men and women and regardless of whether they’re triggered by yourself or a partner. Not surprisingly, the brain’s reward network becomes highly active when you orgasm, especially an area called the ventral striatum, which is associated with feelings of pleasure and motivation. Good music, tasty foods, and recreational drugs also turn on this region.

As you become more aroused leading up to orgasm, several important neurochemicals are released, including endorphins — also known as endogenous opioids — which helps explain why sex, solo or partnered, feels so good. Endorphins are also why masturbating can help people with pain relief, as they activate the same brain network as prescription opioids. Ever wondered about people’s tendency to pass out afterward? The hormone vasopressin, which is a somnolent, or sleep aid, spikes during orgasm. So does oxytocin, which is conventionally known as the bonding hormone. It also decreases cortisol levels, resulting in the stress reduction many people seek from a solo session.

The most important neurochemical for arousal and orgasm is dopamine, which causes feelings of reward, desire, and motivation. A rush of dopamine in the ventral striatum during arousal and orgasm is one reason masturbation and sex have been labeled as addictive. However, just because something causes a surge in dopamine doesn’t mean it’s habit-forming.

“When you masturbate or have sex, the areas of the brain that are active are primary reward [regions],” says Nicole Prause, a neuroscientist and founder of the sexual biotechnology company Liberos. “But for something to be addictive, it has to meet many criteria, and it fails a lot of the other ones. For example, we don’t know that there are any withdrawal patterns with masturbation.”

This is not to say that masturbation or porn can’t be problematic for people, but the experts would call it a compulsive sexual behavior instead of an addiction. In some of those instances, the compulsion is similar to obsessive-compulsive disorder, says Justin Lehmiller, a research fellow at the Kinsey Institute at Indiana University. In other cases, he says, “there’s usually some other underlying issue that’s creating the problem, and so the masturbation and porn are a symptom rather than a cause of the issue.”

Mateusz Gola, a research scientist at UC San Diego, says problems can arise when masturbation is used not just to release sexual tension, but to help someone manage their stress, anxiety, or loneliness. “[It] can be a coping strategy to avoid the current difficulties in life. And if this is the primary purpose of masturbation, then it can become a problematic behavior,” he says.

According to Gola, 10% of men and 2% of women report having a problem with masturbating to porn, in some cases doing it 20 to 30 times a week. However, it’s not the frequency that defines the behavior as compulsive. “It’s not a behavior they really want to do. It’s a behavior they have this internal urge to do,” he explains. “For them, it’s usually not a pleasant behavior. They often have a feeling of losing control over their sexual behaviors.”

“There’s no specific frequency of masturbation that you could look at and objectively say that’s too much or not enough,” Lehmiller adds. “It’s not so much about frequency but about how is it affecting you personally. If you’re masturbating so much that it’s interfering with your everyday life and functioning and causing you great distress, that’s something that’s worth talking about.”