BackgroundThe efficacy of coronavirus disease 2019 (COVID‐19) vaccines in preventing SARS‐CoV‐2 infection in patients with hepatocellular carcinoma (HCC) is not clear.MethodsFrom January 2022 to October 2022, patients diagnosed with HCC in a prospective, multicenter, observational cohort were analyzed.ResultsOne hundred and forty‐one patients with (n = 107) or without COVID‐19 vaccination (n = 34) were included. The number of patients with severe or very severe infection was relatively lower in the vaccinated group (3.7% vs. 11.8%, p = 0.096). Median infection‐free survival in the vaccinated group (14.0 vs. 8.3 months, p = 0.010) was significantly longer than that in the unvaccinated group. COVID‐19 vaccination (hazard ratio (HR) HR = 0.47), European Cooperative Oncology Group performance score = 0 (HR = 2.06), and extrahepatic spread (HR = 0.28) were found to be the independent predictive factors for infection‐free survival.ConclusionCOVID‐19 vaccines could effectively reduce the SARS‐Cov‐2 infection in patients with HCC.