Currently, metformin is the first-line medication to treat type 2 diabetes mellitus (T2DM) in most guidelines and is used daily by >200 million patients. Surprisingly, the mechanisms underlying its therapeutic action are complex and are still not fully understood. Early evidence highlighted the liver as the major organ involved in the effect of metformin on reducing blood levels of glucose. However, increasing evidence points towards other sites of action that might also have an important role, including the gastrointestinal tract, the gut microbial communities and the tissue-resident immune cells. At the molecular level, it seems that the mechanisms of action vary depending on the dose of metformin used and duration of treatment. Initial studies have shown that metformin targets hepatic mitochondria; however, the identification of a novel target at low concentrations of metformin at the lysosome surface might reveal a new mechanism of action. Based on the efficacy and safety records in T2DM, attention has been given to the repurposing of metformin as part of adjunct therapy for the treatment of cancer, age-related diseases, inflammatory diseases and COVID-19. In this Review, we highlight the latest advances in our understanding of the mechanisms of action of metformin and discuss potential emerging novel therapeutic uses.