Traditional methods for determining the chemical composition of cattle feces are uneconomical. In contrast, near-infrared reflectance spectroscopy (NIRS) has emerged as a successful technique for assessing chemical compositions. Therefore, in this study, the feasibility of NIRS in terms of predicting fecal chemical composition was explored. Cattle fecal samples were subjected to chemical analysis using conventional wet chemistry techniques and a NIRS spectrometer. The resulting fecal spectra were used to construct predictive equations to estimate the chemical composition of the feces in both cows and calves. The coefficients of determination for calibration (RSQ) were employed to evaluate the calibration of the predictive equations. Calibration results for cows (dry matter [DM], RSQ = 0.98; crude protein [CP], RSQ = 0.93; ether extract [EE], RSQ = 0.91; neutral detergent fiber [NDF], RSQ = 0.82; acid detergent fiber [ADF], RSQ = 0.89; ash, RSQ = 0.84) and calves (DM, RSQ = 0.92; CP, RSQ = 0.89; EE, RSQ = 0.77; NDF, RSQ = 0.76; ADF, RSQ = 0.92; ash, RSQ = 0.97) demonstrated that NIRS is a cost-effective and efficient alternative for assessing the chemical composition of dairy cattle feces. This provides a new method for rapidly predicting fecal chemical content in cows and calves.