Geniposide is a medicine isolated from Gardenia jasminoides Ellis, which is a traditional Chinese herb that is widely used in Asia for the treatment of inflammation, brain diseases, and hepatic disorders. Mastitis is a highly prevalent and important infectious disease. In this study, we used a lipopolysaccharide (LPS)-induced mouse mastitis model and LPS-stimulated primary mouse mammary epithelial cells (mMECs) to explore the anti-inflammatory effect and the mechanism of action of geniposide. Using intraductal injection of LPS as a mouse model of mastitis, we found that geniposide significantly reduced the infiltration of inflammatory cells and downregulated the production of tumor necrosis factor-alpha (TNF-alpha), interleukin-1 beta (IL-1 beta), and interleukin-6 (IL-6). To further investigate the anti-inflammatory mechanism, we used LPS-stimulated mMECs as an in vitro mastitis model. The results of enzyme-linked immunosorbent assay (ELISA) and quantitative real-time polymerase chain reaction (qRT-PCR) showed that geniposide inhibited the expression of TNF-alpha, IL-1 beta, and IL-6 in a dose-dependent manner. Western blot analysis demonstrated that geniposide could suppress the phosphorylation of inhibitory kappa B (I kappa B alpha), nuclear factor-kappa B (NF-kappa B), p38, extracellular signal-regulated kinase (ERK), and c-Jun N-terminal kinase (JNK). Geniposide also inhibited the expression of toll-like receptor 4 (TLR4) in the LPS-stimulated mMECs. In conclusion, geniposide exerted its anti-inflammatory effect by regulating TLR4 expression, which affected the downstream NF-kappa B and mitogen-activated protein kinase (MAPK) signaling pathways. Thus, geniposide may be a potential drug for mastitis therapy.