Cancer is a leading cause of death in Korea, with the number and prevalence of cancer patients gradually increasing. This study was aimed to examine whether statin prescription in cancer patients is inversely associated with all-cause mortality. This retrospective study used the Korean nationwide health insurance claim data. The patients were divided into four groups based on the duration of statin prescription: non-users, T1, T2, and T3. Kaplan-Meier estimates and log-rank tests were performed to compare the survival rate among the four groups. Cox proportional hazards regression models were constructed to calculate hazard ratios (HRs) and 95% confidence intervals (CIs) for all-cause mortality. A total of 154,916 patients were included (67,207 men and 87,709 women). The median study duration was 14.6 years. The estimated cumulative survival rate was the lowest in statin non-users and the highest in T3 in both sexes. After full adjustment, HRs (95% CIs) for all-cause mortality of T1, T2, and T3 were 0.637 (0.619 − 0.658), 0.482 (0.462 − 0.503), and 0.258 (0.244 − 0.272), respectively, in men and 0.608 (0.580 − 0.637), 0.406 (0.385 − 0.430), and 0.190 (0.178 − 0.203), respectively, in women. Even after stratifying overall cancers into the most common cancer types, statin prescription was inversely associated with all-cause mortality in most male and female cancer types in a dose-response manner. Statin prescription among cancer patients was inversely associated with all-cause mortality in both sexes and in most cancer types after stratification.