A method for extracting hyodeoxycholic acid from pig gall paste comprises the following steps: step 1, adding sodium hydroxide and water into the pig gall paste, heating to 100-110 DEG C, stirring and refluxing for 18-20 hours, standing and cooling to room temperature, and removing an upper solution; 2, adjusting the pH value of the lower-layer solution obtained in the step 1 to 8.2-8.3, adding magnesium salt, stirring and crystallizing for 4-6 hours, filtering, and collecting a solid; step 3, adding water into the solid collected in the step 2, heating to 40-50 DEG C, adding an acidic solution to adjust the pH to 6.2-6.3, stirring, and filtering to obtain a crude product; step 4, adding water and sodium carbonate into the crude product prepared in the step 3, stirring, heating to 90-100 DEG C, refluxing for 1 hour, standing to room temperature, and collecting filtrate; and 5, adjusting the pH value of the filtrate obtained in the step 4 to 3.3-3.4, carrying out filter pressing, washing with a sodium bicarbonate solution until the pH value is 6.5-6.6, drying, and crushing to obtain the hyodeoxycholic acid. The yield of the hyodeoxycholic acid prepared by the method is up to 35%, the melting point is 200 DEG C, the preparation steps are simple, no organic solvent is adopted for extraction, and the cost is low.