Significant differences have been discovered between subtypes of Crohn's disease (CD) and ulcerative colitis (UC). The role of gut microbiota in promoting the onset of UC and CD is established, but conclusions regarding subtype-specific analyses remain limited. This study aims to explore the influence of gut microbiota on subtypes of UC and CD, offering novel insights into the pathogenesis and treatment of UC and CD.Two-sample Mendelian randomization (MR) analysis was employed to examine the causal relationship between subtypes of UC and CD and gut microbiota composition. Gut microbiota data were sourced from the International Consortium MiBioGen, while UC and CD data were obtained from FINNGEN. Eligible single nucleotide polymorphisms (SNPs) were selected as instrumental variables. Multiple analytical approaches such as inverse variance-weighted (IVW), MR-Egger regression, weighted median, weighted mode, and MR-RAPS were utilized. Sensitivity analyses including MR-Egger intercept test, Cochran's Q test, and leave-one-out analysis were conducted for quality control. Subsequently, we employed multivariable IVW, MR-Egger, weighted median, and LASSO regression methods to identify independently significant genera or families and conducted sensitivity analyses. We have determined that Hungatella, Acidaminococcaceae, and 15 other microbial taxa act as protective factors for various CD and UC subtypes, while Terrisporobacter, Anaerostipes, and 23 other microbial taxa are associated with increased risk for different CD and UC subtypes. Furthermore, through multivariable MR analysis, we have identified significant genera or families with independent effects. Our study confirms a causal relationship between dysbiosis of gut microbiota and the occurrence of CD and UC subtypes. Furthermore, it validates etiological distinctions among different subtypes of CD and UC. A novel approach to adjunctive therapy involving distinct UC or CD subtypes may involve the use of probiotics and represents a potential avenue for future treatments.