To develop a sensitive and accurate method combining liquid and solid phase extraction with ultra-performance liquid chromatography-electrospray ionization tandem mass spectrometry to analyze 27 dyes.Methods:Different preparations,chromatography conditions and polarity of ESI were applied for 3 categories of lipophilic,acidic and basic dyes respectively.Four species of herbs representing different parts of plant were selected for methodology observation.Results:The linear correlation coefficient was good(r ≥ 0.997).The LODs of oil soluble and basic dyes were 0.03~3.87 ng/g and acid dyes were 0.003~1.94 μg/g respectively.The accuracies and precisions were 70%~105% and 0.9%~6.8% respectively.Conclusion:After detecting 80 samples of 25 species herbs,this method proved to be reliable,efficient and accurate in the detection of different kinds of dyes in the complex matrix of herbs.