In this study, cellulose-rich residue (purity of 90.2%) removed from barley straw was used to obtain cellulose nanofiber hydrogels (1–2 wt%) by high-intensity ultrasound treatments at 1200 W for 10–30 min. The highest water retention value (82.9±0.8 g/g) and fibrillation yield (62.12±0.13 wt%) of hydrogel were obtained by 1 and 2 wt% cellulose nanofibers, respectively, after ultrasound treatment at 1200 W for 20 min. Also, chitosan (1–3 wt%) was added to the cellulose nanofiber hydrogels by ultrasound treatment at 1200 W/20 min. The addition of chitosan reduced the water retention value and fibrillation yield. All hydrogels exhibited a typical elastic gel-like behavior. Then, the hydrogels were dried using supercritical CO2 to form aerogels, and their properties (bulk density, porosity, stiffness, functional groups, morphology, and thermal behavior) were determined. The lowest bulk density (0.056±0.011 g/cm3) and the highest porosity (96.50±0.17%) was achieved using 1 wt% cellulose nanofiber. The addition of chitosan at 3 wt% increased aerogel stiffness to 3200.10±8.80 g/mm.