The present study demonstrates that berberine hydrochloride exerts anti-inflammatory effects by inhibiting inflammatory cell infiltration, the production of TNF-α, IL-1β, and IL-6, and the activation of the TLR4/NF-κB signaling pathway in a mouse model of mastitis. This evidence concerns the gene NFKB1 and mastitis.