Background: Hepatocellular carcinoma (HCC) is one of the most lethal cancers. Nutrition- and life style-associated risk factors are increasingly prevalent. Metformin, the mainstay of type 2 diabetes mellitus (T2DM)-treatment, reduces the risk of hepatocarcinogenesis. However, its influence on the prognosis of patients with HCC has not been investigated on a large scale, yet. Methods: Five thousand and ninety-three patients treated for HCC between 2000 and 2016 at three referral centres were included in this retrospective multicentre study. The aim of this study was to assess whether treatment with metformin for T2DM is associated with a prolonged overall survival (OS) in patients diagnosed with HCC. Results: Among 5093 patients with HCC, 1917 patients (37.6%) were diagnosed with T2DM, of which 338 (17.6%) received treatment with metformin. Compared to diabetic patients not treated with metformin, patients on metformin had a significantly better hepatic function (Child-Pugh-Score A: 69.2% vs 47.4%, P < 0.001) and underwent significantly more often tumour resection (22.1% vs 16.5%, P = 0.024). Patients on metformin had a significantly longer median OS (mOS) compared to diabetic patients not treated with metformin (22 vs 15 months, P = 0.019). The prolongation of survival was most significant in patients treated with surgery. Using a propensity score match (PSM), patients were adjusted for hepatic function and initial therapy. In the matched cohorts, mOS remained significantly longer in metformin-treated patients (22 vs 16 months, P = 0.021). Co-treatment of metformin and sorafenib was associated with a survival disadvantage. Conclusion: Treatment with metformin was associated with an improved survival in patients with T2DM and HCC. This effect was most pronounced in patients at potentially curative tumour stages.