The invention relates to a method for extracting and purifying matrine from sophora moorcroftiana, and belongs to the technical field of biological extraction. The method comprises the following steps: pretreating a sophora moorcroftiana raw material, carrying out thermal extraction with water-containing methanol, carrying out alcohol precipitation, carrying out solid-liquid separation, carrying out adsorption purification, concentrating, and crystallizing to obtain a pure total matrine product, crushing and sieving branches and roots, soaking the crushed and sieved branches and roots in ethanol with the concentration of 91% or above, carrying out thermal extraction for a period of time, filtering, and extracting filter residues. Through extraction with water-containing methanol and then by treatments of alcohol precipitation, solid-liquid separation, concentration and crystallization, the purity of the total matrine can be improved, and the total matrine is safe to use and does not influence the environment. According to the method, the raw materials are pretreated by using high-concentration ethanol under the specific conditions, and then matrine is extracted by using high-concentration methanol under specific regulation, so that the interference of impurities can be well avoided in subsequent purification, and the purity of matrine can be improved; and the purity of matrinecan be further improved through adsorption of the macroporous resin HPD600.