ObjectiveTo investigate the causal relationship between gut microbiota and idiopathic pulmonary fibrosis (IPF). MethodsGenome-wide association studies (GWAS) data of gut microbiota and IPF were obtained from MiBioGen and Finngen databases, respectively. Instrumental variables were screened by means of significance, linkage disequilibrium, weak instrumental variable screening, and removal of confounding factors (genetics, smoking, host characteristics). Inverse variance weighted (IVW) was used as the main Mendelian randomization (MR) analysis method, and the weighted median, simple mode, MR-Egger, and weighted mode were used to perform MR to reveal the causal effect of gut microbiota and IPF. The Cochrane's Q, leave-one-out, MR-Egger-intercept, and Mendelian randomization pleiotropy residual sum and outlier (MR-PRESSO) and Steiger tests were used to analyze the heterogeneity, horizontal pleiotropy, outliers, and directionality, respectively. ResultsIVW analysis results showed that Actinomycetes [OR=1.773, 95%CI (1.323, 2.377), P<0.001], Erysipelatoclostridium [OR=2.077, 95%CI (1.107, 3.896), P=0.023], and Streptococcus [OR=1.35, 95%CI (1.100, 1.657), P=0.004] could increase the risk of IPF. Bifidobacterium [OR=0.668, 95%CI (0.620, 0.720), P<0.001], Ruminococcus [OR=0.434, 95%CI (0.222,0.848), P=0.015], and Tyzzerella [OR=0.479, 95%CI (0.304, 0.755), P=0.001] could reduce the risk of IPF. No significant heterogeneity, horizontal pleiotropy, outliers, and reverse causality were found. ConclusionActinobacteria, Erysipelatoclostridium and Streptococcus may increase the risk of IPF, while Bifidobacterium, Ruminococcus and Tyzzerella may reduce the risk of IPF. Regulation of the above gut microbiota may become a new direction in the study of the pathogenesis of IPF.