Synergistic effects and stability mechanism of carboxylated cellulose nanofiber (CCNF) and hydrocarbon surfactants on the environmentally friendly foam are investigated in this work. Higher concentrations of CCNF decelerate the bubble coarsening and liquid drainage processes, consequently enhancing foam stability. Increasing viscosity is the primary cause of foam stability enhancement for all surfactant solutions. However, the generation of aggregates is still another reason for the enhanced stability of CTAB/CCNF foam. In addition, CCNF diminishes the foaming ability of all surfactants. Furthermore, as CCNF exceeds 0.8 wt.%, the foaming ability of all surfactants diminishes noticeably, with CTAB solution experiencing a more pronounced reduction. In SDS solutions, the foaming ability is governed by viscosity, whereas in CTAB solutions, it is influenced by adsorption kinetics and viscosity.