Ethylene glycol (EG) and diethylene glycol (DEG) are two contaminants known to cause a variety of human health problems, when ingested in certain amounts, they can cause adverse effects such as nephrotoxicity, neurotoxicity and even death. They are widely found in propylene glycol, which is commonly used as a base for pharmaceutical syrups. The aim of this study was to develop an analytical method for the evaluation of EG and DEG in commercially available pediatric syrups. In this study, a fast, simple and reliable ultrahigh performance supercritical fluid chromatography-electrospray ionization-mass spectrometry (UHPSFC-ESI-MS) method was developed. The work involved the evaluation of three derivatization reagents for UHPSFC-ESI-MS. Benzoyl chloride was finally selected as the optimal derivatization reagent. Compared with an approach without derivatization, the present method achieved the separation and detection of EG and DEG efficiently, sensitively and rapidly, and analysis of EG and DEG in syrup formulations was realized within 7 min. The linear determination coefficients of EG and DEG in the concentration range of 0.25–25.0 μg/mL were greater than 0.999. The limits of detection for EG and DEG were 0.02 μg/mL and 0.07 μg/mL, respectively, and the limits of quantification were 0.09 μg/mL and 0.25 μg/mL, respectively. The recovery rates of DEG and EG ranged from 85.5%–108.1% and 86.7%–117.2%, respectively. The absolute values of the matrix effects in the three types of syrups considered were all less than 10%. Meanwhile, a gas chromatography-hydrogen flame ionization detection method was established for cross-testing of the analytical results. In 10 batches of syrup formulations, DEG was not detected by either method. The presence of EG was detected by UHPSFC-ESI-MS in only three batches, none of which exceeded 90.23 parts per million (ppm), with a mean absolute error of 5.95 ppm between the two sets of results. The developed UHPSFC-ESI-MS method was rapid, simple, efficient, sensitive and accurate for the determination of EG and DEG in genuine syrup formulations.