The invention discloses a method for detecting alkaloids and nitrosamines in tobaccos simultaneously, and belongs to the technical field of tobacco chemical composition detection. The method comprises the working procedures of: sample extraction, purification, analysis and quantification. Firstly an internal standard solution and ultrapure water are added into tobacco leaf powder, extract liquor passes through a filter film after ultrasonic extraction, then methanol is added, protein is removed through centrifugation after shaking, and supernatant is subjected to liquid chromatography-mass spectrometry. After standard solutions of compounds to be detected with different concentration gradients are prepared by adopting a mixing preparation method, and the liquid chromatography-mass spectrometry is carried out, standard curves of instrument responses of the compounds to the actual concentrations of the solutions are drawn, curve equations are fitted, and the detection concentrations are calculated according to measured values of the instrument responses of the compounds to be detected and converted to the actual concentrations of the compounds to be detected in tobacco samples. The detection method provided by the invention can be used for carrying out the qualitative and quantitative analysis on alkaloids and nitrosamines in the tobacco samples simultaneously, and is easy and convenient to operate, good in reproducibility, high in analytic sensitivity and accurate in quantification.