Opioids are chemical substances that relieve pain. There are a wide range of natural and artificial opioids. They are used in hospitals to treat acute pain, as can occur after an operation. They can also be used to relieve pain, where treatment no longer makes sense, for example in certain cancer patients. Drugs that can relieve pain are broadly known as analgesics.