It is currently believed that inflammation acts as a central part in the pathophysiology of depression. Rosemary extracts (RE), the crucial active constituents extracted from Rosmarinus officinalis Linn, have drawn wide concerns because of their potential for anti-inflammatory effects. However, no study has highlighted the antidepressant effects of RE on chronic restraint stress (CRS) mice, and the inflammatory mechanisms related to gut microbiome have not yet been elucidated. This study showed that depressive-like behaviors, gut microbiota dysbiosis, and activation of inflammatory reactions in the hippocampus and serum of CRS mice, as well as activation of inflammatory reactions in BV-2 microglia cells induced by lipopolysaccharide (LPS), could be attenuated by RE. We found that the pretreatment with RE increased the time in the center of open field test (OFT), and decreased immobility duration in tail suspension test (TST) as well as forced swimming test (FST). Furthermore, RE enhanced the sequences proportion of Lactobacillus and Firmicutes, and reduced the sequences proportion of Bacteroidetes and Proteobacteria in feces. Moreover, RE obviously suppressed protein expression of IL-1β, TNF-α, p-NF-κ B p65 and Iba1 in hippocampus, and elevated BDNF as well as p-AKT/AKT expression. Importantly, pre-incubation with RE protected microglia by alleviating protein expression of IL-1β, TNF-α and p-NF-κ B p65 induced by LPS. Additionally, RE downregulated the level of IL-1β and TNF-α in serum. In conclusion, this study showed the antidepressant effects of RE are mediated by anti-inflammatory effects in hippocampus, serum and BV-2 microglia as well as rebalancing gut microbiota.