Context: Sexual function is the health-related quality of life (HRQOL) domain most commonly impaired after prostate cancer treatment; however, validated tools to enable personalized prediction of erectile dysfunction after prostate cancer treatment are lacking. Objective: To predict long-term erectile function following prostate cancer treatment based on individual patient and treatment characteristics. Design: Pretreatment patient characteristics, sexual HRQOL, and treatment details measured in a longitudinal academic multicenter cohort (Prostate Cancer Outcomes and Satisfaction With Treatment Quality Assessment; enrolled from 2003 through 2006), were used to develop models predicting erectile function 2 years after treatment. A community-based cohort (community-based Cancer of the Prostate Strategic Urologic Research Endeavor [CaPSURE]; enrolled 1995 through 2007) externally validated model performance. Patients in US academic and community-based practices whose HRQOL was measured pretreatment (N=1201) underwent follow-up after prostatectomy, external radiotherapy, or brachytherapy for prostate cancer. Sexual outcomes among men completing 2 years' follow-up (n=1027) were used to develop models predicting erectile function that were externally validated among 1913 patients in a community-based cohort. Main Outcome Measures: Patient-reported functional erections suitable for intercourse 2 years following prostate cancer treatment. Results: Two years after prostate cancer treatment, 368 (37% [95% CI, 34%-40%]) of all patients and 335 (48% [95% CI, 45%-52%]) of those with functional erections prior to treatment reported functional erections; 531 (53% [95% CI, 50%-56%]) of patients without penile prostheses reported use of medications or other devices for erectile dysfunction. Pretreatment sexualHRQOLscore, age, serum prostate-specific antigen level, race/ethnicity, body mass index, and intended treatment details were associated with functional erections 2 years after treatment. Multivariable logistic regression models predicting erectile function estimated 2-year function probabilities from as low as 10% or less to as high as 70% or greater depending on the individual's pretreatment patient characteristics and treatment details. The models performed well in predicting erections in external validation among CaPSURE cohort patients (areas under the receiver operating characteristic curve, 0.77 [95% CI, 0.74-0.80] for prostatectomy; 0.87 [95% CI, 0.80-0.94] for external radiotherapy; and 0.90 [95% CI, 0.85-0.95] for brachytherapy). Conclusion: Stratification by pretreatment patient characteristics and treatment details enables prediction of erectile function 2 years after prostatectomy, external radiotherapy, or brachytherapy for prostate cancer. ©2011 American Medical Association. All rights reserved.