Codeine is an oral prescription opioid (narcotic) drug most commonly used to treat mild-to-moderate pain, as a cough suppressant, and to help relieve pain from tension headaches. It is often combined with other medications for these or other uses and can be habit-forming.