Background Pain problems are common in children and adolescents. Measures of health-related quality of life (HRQoL) can be used to assess children’s subjective perspectives of pain experience and its impact on their life. The aims of the study were to describe HRQoL and the prevalence of pain in a nonclinical population of children and adolescents, and to analyze the relationships between HRQoL, pain, sex, and age in a sample of children and adolescents aged 8–18 years. Methods This cross-sectional study involved a cluster sample of 20 randomly selected schools drawn within a region of Norway. The final study sample included 1099 children and adolescents. We measured HRQoL using the generic questionnaire KIDSCREEN-52 and pain using questions from the Lübeck Pain-Screening Questionnaire. Multiple regression was used to analyze relationships between HRQoL and sex, age, and pain. Results The response rate was 74%. A large percentage of the sample, 60%, reported pain, and girls reported significantly more pain than boys, 76% of the girls in the age group 16–18 years reported pain. The KIDSCREEN-52 scores differed between girls and boys, and on average, girls reported a significantly lower HRQoL than boys on most dimensions. Pain problems were associated with lower HRQoL, and older girls were most impaired by pain. Conclusions The findings from this study indicate that pain problems are highly prevalent in children, and more prevalent in girls than in boys. HRQoL was impaired for all 10 dimensions of the KIDSCREEN-52 in children with pain. The subscales self-perception, psychological well-being, mood, relationship with parents, and school environment were most affected.