Opioids are mainly used to treat both acute and chronic pain. Several opioids are metabolized to some extent by CYP2D6 (codeine, tramadol, hydrocodone, oxycodone and methadone). Polymorphisms in CYP2D6 have been studied for an association with the clinical effect and safety of these drugs. Other genes which have been studied for their association with opioid clinical effect or adverse events include OPRM1 (mu receptor) and COMT (catechol-O-methyltransferase). This guideline updates and expands the 2014 Clinical Pharmacogenetics Implementation Consortium (CPIC) guideline for CYP2D6 genotype and codeine therapy and includes a summation of the evidence describing the impact of CYP2D6, OPRM1 and COMT on opioid analgesia and adverse events. We provide therapeutic recommendations for the use of CYP2D6 genotype results for prescribing codeine and tramadol and describe the limited and/or weak data for CYP2D6 and hydrocodone, oxycodone and methadone and for OPRM1 and COMT for clinical use.