Diclofenac (DIC) is one of the most commonly prescribed non-steroidal anti-inflammatory drugs and has been shown to cause oxidative stress and liver injury. The current study investigated protective effects of metformin against DIC-induced hepatic toxicity in both in vitro and in vivo models. For the in vitro study, HepG2 cells were exposed to DIC in the presence or absence of metformin. The effect of metformin on cell viability was evaluated by MTT assay. Oxidative stress parameters (malondialdehyde (MDA), total thiol molecules (TTM), and total antioxidant capacity (TAC)) were assessed. For the in vivo study, thirty-six male Wistar rats were randomly divided into 6 groups. These groups were normal saline, metformin (200 mg/kg), DIC (50 mg/kg/day), DIC + metformin (50, 100, and 200 mg/kg/day). Histopathological studies and serum levels of aspartate aminotransferase (AST), alanine aminotransferase (ALT), alkaline phosphatase (ALP), lactate dehydrogenase (LDH), albumin, direct and total bilirubin were measured. Also, oxidative stress parameters were assessed in liver tissue. Furthermore, expression of glutathione peroxidase (GPX)-1, −3, and −4, catalase (CAT), superoxide dismutase (SOD)-1, and −3 was examined using the real-time PCR method in hepatic tissue. In the in vitro study, metformin significantly prevented DIC-induced loss in cell viability in HepG2 cells. Metformin markedly reduced DIC-induced elevation of MDA levels and increased the TAC and TTM levels. In the in vivo study, metformin significantly prevented DIC-induced changes in hematological and histological markers. Administration of metformin significantly improved oxidative stress parameters in liver tissue. In addition, metformin increased the expression of antioxidant enzymes. Our results suggest that metformin exerts a significant protective effect against DIC-induced hepatic toxicity.