Codeine is an opiate/opioid medication, sometimes known as a narcotic. It is beneficial for treating mild to moderate pain (severe), coughing, and diarrhea. Codeine works by putting a stop to pain signals from traveling along the brain’s nerves and relieves the pain by holding the pain signals to move further to the brain through nerves.