Aims: Sweroside, a secoiridoid glucoside extracted from Swertia pseudochinensis Hara, is reported to possess antioxidant and anti-inflammatory activities. However, whether sweroside has a protective effect on myocardial ischemia–reperfusion (IR) injury is yet to be elucidated. The present study aimed to confirm the cardioprotective effect of sweroside and to identify its underlying mechanism.Methods and Results: H9c2 cells were pretreated with sweroside and then underwent hypoxia–reoxygenation. Cell Counting Kit-8, creatine kinase-myocardial band (CK-MB) and lactate dehydrogenase (LDH) assays were conducted to detect cell viability and myocardial injury, respectively. The Langendorff method was used to induce myocardial IR injury ex vivo. Triphenyltetrazolium chloride staining was performed to detect myocardial infarct size, while protein expression was analyzed using western blotting. Overall, the results indicated that sweroside pretreatment dose-dependently led to a significant enhancement in cell viability, a decrease in release of CK-MB and LDH, a reduction in infarct size, and an improvement in cardiac function. Additionally, sweroside pretreatment caused a marked suppression of oxidative stress, as evidenced by the fact that sweroside decreased the accumulation of reactive oxygen species and malondialdehyde, while enhancing the activities of superoxide dismutase and glutathione peroxidase. Moreover, sweroside was found to notably repress pyroptosis, as sweroside blocked pore formation in the cell membrane, inhibited caspase-1 and interleukin (IL)-1β activity, and decreased the expression levels of NLR family pyrin domain containing 3 (NLRP3), apoptosis-associated speck-like protein containing a CARD, cleaved caspase-1, and IL-1β. Mechanistically, it was found that sweroside inhibited Kelch-like ECH-associated protein 1 (Keap1) and induced nuclear factor E2-associated factor 2 (Nrf2) nuclear translocation. Furthermore, the inhibition of oxidative stress and pyroptosis by sweroside could be abrogated via the inhibition of Nrf2 expression, which suggested that the protective effect induced by sweroside was Nrf2-dependent.Conclusions: The present study demonstrated that sweroside pretreatment could protect against myocardial IR injury by inhibiting of oxidative stress and NLRP3 inflammasome-mediated pyroptosis partially via modulation of the Keap1/Nrf2 axis.