In this study, we aimed to compare the effects of CO2 pneumoperitoneum on acid-base balance during transabdominal preperitoneal (TAPP) and total extraperitoneal (TEP) procedures for repair of inguinal hernias. The study cohort comprised 100 patients who underwent repair of primary inguinal hernias from 1 June to 30 November 2019. The patients were randomly allocated to TAPP and TEP groups. Their acid-base balance was analyzed by comparing the results of blood gas analysis before and after the operative procedures and dynamic transcutaneous CO2 (TcCO2) changes during the procedures. There were no statistically significant differences among groups in demographics, including sex, age, and hernia type. There were also no significant differences between the two groups in anesthesia time, incidence of perioperative complications, or type of management of the hernia sac (all P > 0.05). The operation time was shorter for the TEP than the TAPP group (P < 0.01). In terms of CO2 metabolism and acid-base balance, the following differences between the two groups were statistically significant: changes in PaCO2 (7.54 ± 3.36 vs. 20.36 ± 7.60mmHg, P < 0.01), changes in TcCO2 (8.86 ± 3.57 vs. 17.40 ± 8.03mmHg, P < 0.01), rate of change in TcCO2 (0.22 ± 0.11 vs. 1.03 ± 0.56, P < 0.01), and changes in pH (- 0.05 ± 0.28 vs. - 0.15 ± 0.76, P < 0.01). TAPP and TEP can achieve good results in the treatment of inguinal hernia. Although no serious complications occurred, TEP procedures may cause more serious CO2 accumulation and quicker acidosis than TAPP procedures.