Alzheimer's disease is a chronic neurological ailment that seriously threatens human health and imposes a huge burden on families and the society at large. Emerging evidence suggests that neuroinflammation is an important pathological manifestation of neurodegenerative diseases, and currently considered a new research target. We previously found that artemisinin B from Artemisia annua Linn. has strong anti-inflammatory and immunological activities. In the present study, we assessed the anti-neuroinflammatory effects of artemisinin B in vitro and in vivo, exploring the underlying mechanisms. The results demonstrated that artemisinin B inhibited NO secretion from LPS-induced BV2 cells and significantly reduced the expression levels of the inflammatory cytokines IL-1β, IL-6 and TNF-α. This was accompanied by reduced gene expression levels of MyD88 and NF-κB as well as TLR4 and MyD88 protein levels. These inhibitory effects were further confirmed in AD model mice. This study also showed that artemisinin B improved spatial memory in dementia mice in the water maze and step-through tests, and altered the pathological features and the levels of inflammatory cytokines in the hippocampus and the cortex. These results suggested that artemisinin B might inhibit neuroinflammation and exert neuroprotective effects on cognitive functions by modulating the TLR4-MyD88-NF-κB signaling pathway. This study provides direct evidence for the potential application of artemisinin B in the treatment of neuroinflammatory diseases.