The diagnosis of liver cancer often involves a combination of imaging studies, laboratory tests, and biopsy. Imaging techniques such as ultrasound, computed tomography (CT), and magnetic resonance imaging (MRI) are used to detect liver masses and assess their characteristics. Laboratory tests may include measuring levels of alpha-fetoprotein (AFP), a tumor marker that can be elevated in liver cancer. A liver biopsy, where a tissue sample is taken for histological examination, may be necessary to confirm the diagnosis and determine the cancer's stage and grade.