Importance: Individuals with mental disorders often develop comorbidity over time. Past studies of comorbidity have often restricted analyses to a subset of disorders and few studies have provided absolute risks of later comorbidity. Objectives: To undertake a comprehensive study of comorbidity within mental disorders, by providing temporally ordered age- and sex-specific pairwise estimates between the major groups of mental disorders, and to develop an interactive website to visualize all results and guide future research and clinical practice. Design, Setting, and Participants: This population-based cohort study included all individuals born in Denmark between January 1, 1900, and December 31, 2015, and living in the country between January 1, 2000, and December 31, 2016. The analyses were conducted between June 2017 and May 2018. Main Outcomes and Measures: Danish health registers were used to identify mental disorders, which were examined within the broad 10-level International Statistical Classification of Diseases and Related Health Problems, 10th Revision, subchapter groups (eg, codes F00-F09 and F10-F19). For each temporally ordered pair of disorders, overall and lagged hazard ratios and 95% CIs were calculated using Cox proportional hazards regression models. Absolute risks were estimated using competing risks survival analyses. Estimates for each sex were generated. Results: A total of 5940778 persons were included in this study (2958293 men and 2982485 women; mean [SD] age at beginning of follow-up, 32.1 [25.4] years). They were followed up for 83.9 million person-years. All mental disorders were associated with an increased risk of all other mental disorders when adjusting for sex, age, and calendar time (hazard ratios ranging from 2.0 [95% CI, 1.7-2.4] for prior intellectual disabilities and later eating disorders to 48.6 [95% CI, 46.6-50.7] for prior developmental disorders and later intellectual disabilities). The hazard ratios were temporally patterned, with higher estimates during the first year after the onset of the first disorder, but with persistently elevated rates during the entire observation period. Some disorders were associated with substantial absolute risks of developing specific later disorders (eg, 30.6% [95% CI, 29.3%-32.0%] of men and 38.4% [95% CI, 37.5%-39.4%] of women with a diagnosis of mood disorders before age 20 years developed neurotic disorders within the following 5 years). Conclusions and Relevance: Comorbidity within mental disorders is pervasive, and the risk persists over time. This study provides disorder-, sex-, and age-specific relative and absolute risks of the comorbidity of mental disorders. Web-based interactive data visualization tools are provided for clinical utility..