Cognitive dysfunction caused by hepatic encephalopathy (HE) improves within the first year after liver transplantation (LT). However, cognitive restitution seems to be incomplete in a subset of patients and after LT a new‐onset cognitive decline was described. Data about the longterm development of cognitive function after liver transplantation (LT) are sparse. This prospective study analyzed whether a history of hepatic encephalopathy (HE) before LT had an impact on the longterm outcome of cognitive function after LT and if patients who underwent LT 5 years earlier showed worse cognitive function than healthy controls. The cognitive function of 34 patients was assessed before LT and at 1 year and 5 years after LT by psychometric tests, including the Repeatable Battery for the Assessment of Neuropsychological Status (RBANS) and the portosystemic encephalopathy syndrome test, which provides the psychometric hepatic encephalopathy score (PHES). Furthermore, patients completed surveys to assess health‐related quality of life (HRQOL). An 22 additional patients were included after LT. Patients were subdivided by having a history of HE before LT. The control group consisted of 55 healthy patients adjusted for age and education. Before LT, patients performed significantly worse than controls in the psychometric tests: RBANS Total Scale (TS), mean ± standard deviation (SD), 92.6 ± 13.3 versus 99.9 ± 12.0, P = 0.01; and PHES, median (interquartile range [IQR]), 0 (−3 to 1) versus 1 (0‐2), P < 0.001. At 1 year after LT, patients with a history of HE still showed cognitive impairment compared with controls: RBANS TS, mean ± SD, 89.8 ± 15.1 versus 99.9 ± 12.0, P < 0.01; and PHES, median (IQR), 0 (−2 to 1.25) versus 1 (0‐2), P = 0.03. At 5 years after LT, patients with and without a history of HE showed normal cognitive function and improved HRQOL. In conclusion, HE‐associated cognitive impairment seems to be reversible within 5 years after LT.