In treating pain, codeine works by mimicking the action of naturally occurring pain-reducing chemicals called endorphins. Endorphins are found in the brain and spinal cord and reduce pain by combining with opioid receptors. Codeine mimics the action of natural endorphins by combining with the opioid receptors in the brain and spinal cord. This blocks the transmission of pain signals sent by the nerves to the brain. Therefore, even though the cause of the pain may remain, less pain is actually felt.
With diarrhoea, codeine works by acting on opioid receptors that are found in the muscles lining the walls of the intestines. This reduces the muscular contractions of the intestine (called peristalsis) that move food and faecal matter through the gut. The speed at which the gut contents are pushed through the intestines is therefore reduced, allowing more time for water and electrolytes to be reabsorbed from the gut contents back into the body. This results in firmer stools that are passed less frequently.