Opioids are perhaps the most effi cacious analgesic agents available to the clinician in everyday clinical practice. While providing highly effective pain relief, the therapeutic activity of opioids is compromised by gastrointestinal adverse events related to their interaction with the opioid signaling system of the gut, a complex network of peptides and receptors with opioid-like properties that helps to coordinate gastrointestinal motility and secretion. The effects of opioids on the gut are modulated by genetic polymorphisms in opioid receptors, downstream signaling pathways, and enzymes involved in the metabolism of these opioid analgesics. Here, we focus on the physiology of endogenous opioids and their receptors with particular reference to their effects on gastrointestinal function, the pharmacology of opioid drugs, and molecular and genetic factors that drive the activity of these powerful agents.