Introduction: Headspace gas chromatography–mass spectrometry (HS-GC–MS) is widely considered the gold standard of quantitative fecal VOC analysis. However, guidelines providing general recommendations for bioanalytical method application in research and clinical setting are lacking. Objectives: To propose an evidence-based research protocol for fecal VOC analysis by HS-GC–MS, based on extensive testing of instrumental and sampling conditions on detection and quantification limits, linearity, accuracy and repeatability of VOC outcome. Methods: The influence of the following variables were assessed: addition of different salt solutions, injection temperature, injection speed, injection volume, septum use, use of calibration curves and fecal sample mass. Ultimately, the optimal sample preparation was assessed using fecal samples from healthy preterm infants. Fecal VOC analysis in this specific population has potential as diagnostic biomarkers, but available amount of feces is limited here, so optimization of VOC extraction is of importance. Results: We demonstrated that addition of lithium chloride enhanced the release of polar compounds (e.g. small alcohols) into the headspace. Second, a linear relationship between injection volume, speed and temperature, and fecal sample mass on the abundance of VOC was demonstrated. Furthermore, the use of a septum preserved 90% of the non-polar compounds. By application of optimal instrumental and sampling conditions, a maximum of 320 unique compounds consisting of 14 different chemical classes could be detected. Conclusions: These findings may contribute to standardized analysis of fecal VOC by HS-GC–MS, facilitating future application of fecal VOC in clinical practice.