Berberine is an alkaloid extracted from medicinal plants such as Coptis chinensis and Phellodendron chinense. It possesses anti-inflammatory, anti-tumour and anti-oxidation properties, and regulates Glc and lipid metabolism. This study explored the mechanisms of the protective effects of berberine on barrier function and inflammatory damage in porcine intestinal epithelial cells (IPEC-J2) induced by LPS. We first evaluated the effects of berberine and LPS on cell viability. IPEC-J2 cells were treated with 5 μg/ml LPS for 1 h to establish an inflammatory model, and 75, 150 and 250 μg/ml berberine were used in further experiments. The expression of IL-1β, IL-6 and TNF-α was measured by RT-PCR. The key proteins of the NF-κB/MAPK signalling pathway (IκBα, p-IκBα, p65, p-p65, c-Jun N-terminal kinase (JNK), p-JNK, p38, p-p38, ERK1/2 and p-ERK1/2) were detected by Western blot. Upon exposure to LPS, IL-1β, IL-6 and TNF-α mRNA levels and p-IκBα p-p65 protein levels were significantly enhanced. Pre-treatment with berberine reduced the expression of inflammatory factors and was positively correlated with its concentration, and dose dependently inhibited the expression of IκBα, p-IκBα, p-p65, p-p38 and JNK. These results demonstrated that pre-treating intestinal epithelial cells with berberine was useful in preventing and treating diarrhoea induced by Escherichia coli in weaned pigs.