The invention relates to the technical field of solvent residual detection of drugs, and concretely relates to a method for detecting residual solvents in heparin sodium by headspace gas chromatography. The method optimizes the headspace sampling balance temperature which is an important parameter affecting the peak area ratio of the analytes to an internal standard by adopting the headspace gas chromatography against the technical problem of poor system adaptability of methods for detecting the residual solvents in the heparin sodium in the prior art, and the headspace balance temperature isoptimized to 78-82 DEG C from 90 DEG C. The method for detecting residual solvents in heparin sodium by headspace gas chromatography allows the relative standard deviation of the peak area ratio of the analytes to the internal standard during the repeated introduction of a control to be less than 1.0% and the system applicability to meet requirements, has the advantages of good specificity, good resolution of the analytes, good repeatability and high sensitivity, the detection limit of methanol is 0.0008%, the detection limit of ethanol is 0.0002%, the detection limit of acetone is 0.0001%, the quantitation limit of methanol is 0.0023%, the quantitation limit of ethanol is 0.0007%, and the quantitation limit of acetone is 0.0003%.