Matrix stiffening is one of the major risk factors for hepatocellular carcinoma (HCC) and drives tumor progression. The extracellular matrix (ECM) stiffness of HCC displays mechanical heterogeneity, with stiffness increasing from the core to the invasive frontier. The distribution of liver cancer stem cells (CSCs) is related to this mechanical property. However, it is not sufficiently understood how heterogeneous matrix stiffness regulates the stemness of CSCs. In this study, we developed an adjustable gelatin/alginate hydrogel to investigate the effect of various matrix stiffnesses on CSC stemness under three-dimensional culture conditions. Gelatin/alginate hydrogel with the stiffness of soft (5 kPa), medium (16 kPa), and stiff (81 kPa) were prepared by altering the concentration of calcium ions. It was found that a stiffer matrix promoted stemness-associated gene expression, reduced drug sensitivity, enhanced sphere-forming and clonogenic ability, and tumorigenic potential. Mechanistically, matrix stiffening facilitates CSC stemness by increasing Yes-associated protein (YAP) activity and inhibiting Bcl-2 modifying factor (BMF) expression. Knockdown of YAP or overexpression of BMF significantly attenuated matrix stiffening-induced stemness, suggesting the involvement of YAP and BMF in this process. Together, our results unravel the regulatory mechanism of heterogeneous matrix stiffness on CSC stemness and also provide a novel therapeutic strategy for eradicating CSCs and improving the efficiency of HCC treatment.