Pulmonary atelectasis is present even before surgery in patients with obesity. We aimed to estimate the prevalence and extension of preoperative atelectasis in patients with obesity undergoing bariatric surgery and to determine if variation in preoperative Spo2 values in the seated position at room air is explained by the extent of atelectasis coverage in the supine position. This was a cross-sectional study in a single center specialized in laparoscopic bariatric surgery. Preoperative chest computed tomographies were reassessed by a senior radiologist to quantify the extent of atelectasis coverage as a percentage of total lung volume. Patients were classified as having atelectasis when the affection was ≥2.5%, to estimate the prevalence of atelectasis. Crude and adjusted prevalence ratios (aPRs) and odds ratios (aORs) were obtained to assess the relative prevalence of atelectasis and percentage coverage, respectively, with increasing obesity category. Inverse probability weighting was used to assess the total, direct (not mediated), and indirect (mediated through atelectasis) effects of body mass index (BMI) on preoperative Spo2, and to quantify the magnitude of mediation (proportion mediated). E-values were calculated, to represent the minimum magnitude of association that an unmeasured confounder with the same directionality of the effect should have to drive the observed point estimates or lower confidence intervals (CIs) to 1, respectively. In 236 patients with a median BMI of 40.3 kg/m2 (interquartile range [IQR], 34.6-46.0, range: 30.0-77.3), the overall prevalence of atelectasis was 32.6% (95% CI, 27.0-38.9) and by BMI category: 30 to 35 kg/m2, 12.7% (95% CI, 6.1-24.4); 35 to 40 kg/m2, 28.3% (95% CI, 17.2-42.6); 40 to 45 kg/m2, 12.3% (95% CI, 5.5-24.3); 45 to 50 kg/m2, 48.4% (95% CI, 30.6-66.6); and ≥50 units, 100% (95% CI, 86.7-100). Compared to the 30 to 35 kg/m2 group, only the categories with BMI ≥45 kg/m2 had significantly higher relative prevalence of atelectasis-45 to 50 kg/m2, aPR = 3.52 (95% CI, 1.63-7.61, E-value lower bound: 2.64) and ≥50 kg/m2, aPR = 8.0 (95% CI, 4.22-15.2, E-value lower bound: 7.91)-and higher odds of greater atelectasis percentage coverage: 45-50 kg/m2, aOR = 7.5 (95% CI, 2.7-20.9) and ≥50 kg/m2, aOR = 91.5 (95% CI, 30.0-279.3). Atelectasis percent alone explained 70.2% of the variation in preoperative Spo2. The proportion of the effect of BMI on preoperative Spo2 values <96% mediated through atelectasis was 81.5% (95% CI, 56.0-100). The prevalence and extension of atelectasis increased with higher BMI, being significantly higher at BMI ≥45 kg/m2. Preoperative atelectasis mediated the effect of BMI on Spo2 at room air in the seated position.