What happens in your head when you get flogged? Scientific researchers and professional dominatrixes talk about endorphins and all the other neurochemicals that make bondage so delightful.

There's no denying that understanding how the human body works can lead to some intense sex. After all, as clichéd as it is, the brain is the biggest erogenous zone—and BDSM is no different.

It may conjure up images of bondage, discipline, sadomasochism, dominance, and submission, but many BDSM practictioners attribute the pleasurable pain of their fetish to the endorphin rush that accompanies the acting out of their fantasies. There's even a word for the state of a submissive's mind and body during and after consensual kinky play: subspace, often described as a "floaty" or "flying" feeling.

"For all of us, endorphins bind to opiate receptors to naturally relieve pain," explains Maitresse Madeline Marlowe, a professional dominatrix who also works as a performer and director for Kink.com, a leading BDSM content producer. "Since BDSM play can include power exchange and masochistic acts, endorphins are one of the most common neurotransmitters [produced]."

As far back as 1987, leather activist and author Dr. Geoff Mains hypothesized that BDSM activity stimulated the release of endorphins, but scientists have yet to tease out the exact relationship between neurochemicals and S&M. But subspace does exist: Dr. Brad Sagarin, founder of the Science of BDSM research team and a professor of social and evolutionary psychology at Northern Illinois University, has compared it to runner's high, the sense of euphoria and increased tolerance for pain that some joggers feel after a long run. Except, obviously, one is caused by the asphalt flashing beneath your feet, the other by a whip swishing through the air.

In a 2009 study titled Hormonal Changes and Couple Bonding in Consensual Sadomasochistic Activity, Dr. Sagarin discovered that cortisol levels increase in subs and decrease in doms over the course of a scene. The effect was replicated in the research team's subsequent research: One 2016 preliminary study which measured the brain's executive functioning (i.e. basic control of our thoughts, emotions and actions) after participating in BDSM; and another that found that participants in the extreme S&M ritual known as the Dance of Souls (involving temporary piercings of the skin with weights or hooks attached) exhibited increases in cortisol throughout the ritual.

"Like many potentially stressful or extreme experiences (e.g., sky-diving, fire-walking), individuals' bodies react to that stress when they engage in BDSM," Science of BDSM researcher Kathryn Klement told Broadly. "We interpret these cortisol results to mean that when people engage in BDSM play (as the receiver of sensations) or extreme rituals, their bodies release a hormone usually associated with stress. However, we've also found that people subjectively report their psychological stress decreasing, so there is a disconnect between what the body is experiencing, and what the individual is perceiving."

For their 2016 study on brain functioning, Klement admits that the team didn't directly measure brain activity ("that would require an fMRI, which would be tricky to incorporate into a BDSM scene"). Instead, they had participants complete a Stroop test—a neuropsychological assessment commonly used to detect brain damage—before and after a scene. "Bottoms do much worse on this measure after the scene, while tops show no difference," Klement says.

Photo by Juan Moyano via Stocksy

They inferred from the study that the changes in executive functioning were as a result of the brain redirecting blood flow from higher-order functions to lower-order functions. Writing in the Guardian, Dr. Sagarin revealed that this "temporary impairment of the brain's executive function capability" was often accompanied by "feelings of floating, peacefulness, time distortion, and living in the here and now."

"We interpret these changes to be evidence of subspace, an altered state of consciousness that people who are receiving sensations (the bottoms) can experience," Klement says.

But what about the psychological subspace felt by those experiencing non-physical play, such as humiliation, pet play, and other fetishes? According to Marlowe, this is where an understanding of behavioural psychology comes in handy.

The click of the boot is a neutral stimulus paired with an unconditioned stimulus of licking the boot clean. It is a learned response.

"In the context of humiliation and pet play, classical and operant conditioning play a huge roll in how these types of fetishes play out. Classical conditioning, made famous by Pavlov's dog experiment, involves placing a signal before a reflex," Marlowe explains. "Let's think of it in a scenario where the domme and sub are enjoying puppy play. The domme may present a signal of a click of her boot, which will lead to the privilege of puppy licking the boot clean. The click of the boot is a neutral stimulus paired with an unconditioned stimulus of licking the boot clean. It is a learned response."

Operant conditioning, on the other hand, involves reinforcement or punishment after a behaviour. "In the context of humiliation, it can be used to punish and then reinforce a behaviour until it is made right. Let's say a submissive shows up to be pegged. They made a choice not to shave their derriere hole, [even though the] domme prefers a shaved hole to peg. Instead of getting the pegging session of their dreams, they are humiliated by their domme. I guarantee the next time they arrive to play, that hole would be baby soft. [And] once the sub gets the pegging play of their dreams, it reinforces the voluntary choice to shave."

Snow Mercy, a pro-domme with a PhD in biochemistry, has done a survey of peer-reviewed research and apart from Dr. Sagarin's study, she says there is a dearth of academic literature and empirical data on the relationship between biopsychology and BDSM.

Watch: Meet the Real People Behind Your Virtual Boyfriend

"I cannot say I've used the science of neurochemicals to create a more thorough scene [but] I love studying the science of BDSM," she says. "I find that BDSM research is a relatively new field. No other studies have been published that show the relationship between BDSM and neurochemicals, from what I can tell."

Indeed, most modern academic studies on BDSM are far more focused on questioning and debunking its association with psychopathology. Conversely, one of the earliest reference books on sadomasochist behaviours and relationships, Psychopathia Sexualis, by Richard von Krafft-Ebing in 1886, dismisses the practice and its practitioners as pathological—a trend that continued in the field of psychiatry under Sigmund Freud and other eminent psychiatrists of their times.

In 2006, results from a research project by Dr. Pamela Connolly involving 32 self-identified BDSM practitioners surmised that "although psychoanalytic literature suggests that high levels of certain types of psychopathology should be prevalent among BDSM practitioners, this sample failed to produce widespread, high levels of psychopathology on psychometric measures of depression, anxiety, obsessive-compulsion, psychological sadism, psychological masochism, or PTSD."

Connolly's findings are supported by a 2016 Dutch study of 902 kinksters, published in the Journal of Sexual Medicine, which concluded that the BDSM practitioners were "less neurotic, more extraverted [and] more conscientious" than the 434 respondents in the control. Evidence that BDSM leads to favorable psychological characteristics.

Will academics now turn their sights on the particular psychology and biochemistry occurring during the scenes? Klement says her research team is certainly interested in branching into oxytocin based on their work "indicating that BDSM partners experience increased relationship closeness during scenes." Further studies into the role that endorphins play in relation to subspace and BDSM in general may also be on the cards. "We haven't explored these substances in relation to BDSM, so we can't comment. However, it is possible that changes in these chemicals relate to bottoms' experiences of sub-space," she says.

Mercy certainly expects to see future research done on the relationship between brain activity and S&M activities. "With the destigmatization of BDSM," she says, "I hope to see more studies on the physiology of this practice."