Inadequate pain relief and adverse effects from analgesics remain common in children and adults during the perioperative period. Opioids are the most commonly used analgesics in children and adults to treat perioperative pain. Narrow therapeutic index and a large interpatient variability in response to opioids are clinically significant, with inadequate pain relief at one end of the spectrum and serious side effects, such as respiratory depression and excessive sedation due to relative overdosing, at the other end. Personalizing analgesia during the perioperative period attempts to maximize pain relief while minimizing adverse events from therapy. While various factors influence response to treatment among surgical patients, age, sex, race and pharmacogenetic differences appear to play major roles in predicting outcome. Genetic factors include a subset of genes that modulate the proteins involved in pain perception, pain pathway, analgesic metabolism (pharmacokinetics), transport and receptor signaling (pharmacodynamics). While results from adult genetic studies can provide direction for pediatric studies, they have limited direct applicability, as children's genetic predispositions to analgesic response may be influenced by developmental and behavioral components, altered sensitivity to analgesics and variation in gene-expression patterns. We have reviewed the available evidence on improving and personalizing pain management with opioids and the significance of individualizing analgesia, in order to maximize analgesic effect with minimal adverse effects with opioids. While the early evidence on individual genotype associations with pain, analgesia and opioid adverse outcome are promising, the large amount of conflicting data in the literature suggests that there is a need for larger and more robust studies with appropriate population stratification and consideration of nongenetic and other genetic risk factors. Although the clinical evidence and the prospect of being able to provide point-of-care genotyping to enable clinicians to deliver personalized analgesia for individual patients is still not available, positioning our research to identify all possible major genetic and nongenetic risk factors of an individual patient, advancing less expensive point-of-care genotyping technology and developing easy-to-use personalized clinical decision algorithms will help us to improve current clinical and economic outcomes associated with pain and opioid pain management.