Metformin, a small molecule, antihyperglycaemic agent, is a well-known activator of AMP-activated protein kinase (AMPK) and protects against cardiac fibrosis. However, the underlying mechanisms remain elusive. TGFβ1 is a key cytokine mediating cardiac fibrosis. Here, we investigated the effects of metformin on TGFβ1 production induced by angiotensin II (AngII) and the underlying mechanisms. Wild-type and AMPKα2-/- C57BL/6 mice were injected s.c. with metformin or saline and infused with AngII (3 mg·kg-1 ·day-1 ) for 7 days. Adult mouse cardiac fibroblasts (CFs) were isolated for in vitro experiments. In CFs, metformin inhibited AngII-induced TGFβ1 expression via AMPK activation. Analysis using bioinformatics predicted a potential hepatocyte nuclear factor 4α (HNF4α)-binding site in the promoter region of the Tgfb1 gene. Overexpressing HNF4α increased TGFβ1 expression in CFs. HNF4α siRNA attenuated AngII-induced TGFβ1 production and cardiac fibrosis in vitro and in vivo. Metformin inhibited the AngII-induced increases in HNF4α protein expression and binding to the Tgfb1 promoter in CFs. In vivo, metformin blocked the AngII-induced increase in cardiac HNF4α protein levels in wild-type mice but not in AMPKα2-/- mice. Consequently, metformin inhibited AngII-induced TGFβ1 production and cardiac fibrosis in wild-type mice but not in AMPKα2-/- mice. HNF4α mediates AngII-induced TGFβ1 transcription and cardiac fibrosis. Metformin inhibits AngII-induced HNF4α expression via AMPK activation, thus decreasing TGFβ1 transcription and cardiac fibrosis. These findings reveal a novel antifibrotic mechanism of action of metformin and identify HNF4α as a new potential therapeutic target for cardiac fibrosis. This article is part of a themed section on Spotlight on Small Molecules in Cardiovascular Diseases. To view the other articles in this section visit http://onlinelibrary.wiley.com/doi/10.1111/bph.v175.8/issuetoc. © 2017 The British Pharmacological Society.