The inflammatory response plays an indispensable role in ischemia–reperfusion injury, the most significant of which is the inflammatory response caused by microglial polarization. Anti-inflammatory therapy is also an important remedial measure after failed vascular reconstruction. Maintaining the internal homeostasis of the brain is a crucial measure for suppressing the inflammatory response. The mechanism underlying the relationship between DCPIB, a selective blocker of volume-regulated anion channels (VRAC), and inflammation induced by cerebral ischemia–reperfusion injury is currently unclear. The purpose of this study was to investigate the relationship between DCPIB and microglial M1/M2 polarization-mediated inflammation after cerebral ischemia–reperfusion injury. C57BL/6 mice were subjected to transient middle cerebral artery occlusion (tMCAO). DCPIB was administered by a lateral ventricular injection within 5 min after reperfusion. Behavioral assessments were conducted at 1, 3, and 7 days after tMCAO/R. Pathological injuries were evaluated using TTC assay, HE and Nissl staining, brain water content measurement, and immunofluorescence staining. The levels of inflammatory cytokines were analyzed using qPCR and ELISA. Additionally, the phenotypic variations of microglia were examined using immunofluorescence staining. In mouse tMCAO/R model, DCPIB administration markably reduced mortality, improved behavioral performance, and alleviated pathological injury. DCPIB treatment significantly inhibited the inflammatory response, promoted the conversion of M1 microglia to M2 microglia via the MAPK signaling pathway, and ultimately protected neurons from the microglia-mediated inflammatory response. In addition, DCPIB inhibited oxidative stress induced by cerebral ischemia–reperfusion injury. In conclusion, DCPIB attenuates cerebral ischemia–reperfusion injury by regulating microglial M1/M2 polarization and oxidative stress.