There was no causal relationship between sex hormones and IBD in women (P > 0.05), and there was a causal and positive correlation between SHBG and testosterone and IBD in men.The OR for SHBG was 1.22 (95% CI: 1.09-1.37, P = 0.0004), and for testosterone was 1.20 (95% CI: 1.04-1.39, P = 0.0145).IBD did not significantly interact with female sex hormones but resulted in a decrease in SHBG (OR = 1.02, 95% CI: 1.00-1.04, P = 0.0195) and testosterone (OR = 1.01, 95% CI: 1.00 -1.02, P = 0.0200) in men. This evidence concerns the gene SHBG and inflammatory bowel disease.