Endorphins are endogenous opioid biochemical compounds (peptides), substances produced by the pituitary gland and the hypothalamus in vertebrates. They resemble the opiates in their abilities to produce analgesia and a sense of well-being. In other words, they work as "natural pain killers".

These opoid neuropeptides were first discovered by 1975 John Hughes and Hans Kosterlitz in the brain of a pig. They called their endorphins "enkephalins" (from the Greek egkephalos, "in the head"). Several other types of endorphins were discovered later. The word endorphin itself is abbreviated from "endogenous morphine", which means a morphine produced naturally in the body.

The term "endorphin" is used generally to refer to all of the endogenous opioid compounds and implies a pharmacological activity (analogous to the activity of the corticosteroid category of biochemicals) as opposed to a specific chemical formulation.

How endorphins work is still not fully understood. What is sure, however, is that endorphins bind to the opioid receptors in the brain. They disinhibit the dopamine pathways, causing more dopamine to be released into the synapses.

Endorphins regulate feelings of pain and hunger and are connected to the production of sex hormones.

Oddly enough, they are also generated in response to certain spices, such as chili peppers. Chili peppers have thus been used as a treatment for certain types of chronic pain.

According to some reports, laughter also releases endorphins in the brain. Apart from widening the blood vessels, suppressing the production of stress hormones and raising antibody levels in the blood, laughing would thus also have an analgesic effect.

Another widely publicised situation of endorphin production, is the so-called "runner's high". Any strenuous exercise which will take a person over a certain threshold will activate endorphin production.

One theory of why some people find BDSM activities pleasurable is that these activities stimulate endorphins in a controlled way.