Importance: The association of cardiorespiratory fitness with cancer risk is not clear. Objective: To investigate whether fitness is associated with the risk of diagnosis of common cancers. Design, setting, and participants: In observational analyses, we used multivariable-adjusted Cox proportional hazards models to estimate hazard ratios (HRs) and 95% confidence intervals (CIs) for risk of cancer in a subset of UK Biobank participants who completed a submaximal fitness test in 2009-12 (N=72,572). In secondary analyses, we used a two-sample Mendelian randomization (MR) framework, with genetically predicted fitness as an instrumental variable derived from UK Biobank study participants and genetic cancer data from international consortia. Odds ratios (ORs) were estimated using the inverse-variance weighted method. Relationships between fitness and cancer may be partially mediated by adiposity, and therefore associations were estimated with and without adjustment for adiposity. Exposures: Estimated maximal cardiorespiratory fitness (ml O2⋅min-1⋅kg-1 total-body mass and ml O2⋅min-1⋅kg-1 fat-free mass). Main outcomes and measures: Diagnosis of lung, colon, rectal, endometrial, female breast, and prostate cancer. MR analyses additionally included pancreatic and renal cancers. Results: After a median of 11 years of follow-up, 4,290 cancers of interest were diagnosed. A 3.5 ml O2⋅min-1⋅kg-1 total-body mass increase in fitness (approximately 0.5 standard deviation (SD)) was associated with lower risks of endometrial (HR=0.81, 95% CI 0.73-0.89), colorectal (0.94, 0.90-0.99), and breast cancer (0.96, 0.92-0.99). In MR analyses, higher levels of genetically predicted fitness were associated with a lower risk of breast cancer (OR per genetically predicted 0.5 SD increase in ml O2⋅min-1⋅kg-1 fat-free mass=0.92, 95% CI 0.86-0.98), including estrogen receptor (ER)+ (0.91, 0.84-0.99) and ER- (0.88, 0.80-0.97) subtypes. After adjusting for body fat, both the observational and genetic associations were attenuated. Conclusions and relevance: Higher fitness levels may reduce risks of endometrial, colorectal, and breast cancer, though relationships with adiposity are complex and may mediate these relationships. Aiming to increase fitness, including via changes in body composition, may be an effective strategy for cancer prevention.