Undescended testis, which is a risk factor for testicular cancer, is usually treated surgically, but whether the age at treatment has any effect on the risk is unclear. We studied the relation between the age at treatment for undescended testis and the risk of testicular cancer. We identified men who underwent orchiopexy for undescended testis in Sweden between 1964 and 1999. Cohort subjects were identified in the Swedish Hospital Discharge Register and followed for the occurrence of testicular cancer through the Swedish Cancer Registry. Vital statistics and data on migration status were taken from the Register of Population and Population Changes for the years 1965 through 2000. We estimated the relative risk of testicular cancer using Poisson regression of standardized incidence ratios, comparing the risk in the cohort with that in the general population. We also analyzed the data by means of Cox regression, using internal comparison groups. The cohort consisted of 16,983 men who were surgically treated for undescended testis and followed for a total of 209,984 person-years. We identified 56 cases of testicular cancer during follow-up. The relative risk of testicular cancer among those who underwent orchiopexy before reaching 13 years of age was 2.23 (95% confidence interval [CI], 1.58 to 3.06), as compared with the Swedish general population; for those treated at 13 years of age or older, the relative risk was 5.40 (95% CI, 3.20 to 8.53). The effect of age at orchiopexy on the risk of testicular cancer was similar in comparisons within the cohort. Treatment for undescended testis before puberty decreases the risk of testicular cancer. Copyright 2007 Massachusetts Medical Society.