The invention relates to a method for extracting the hyodeoxycholic acid from the leftovers of pig bile or extracted bilirubin, including saponify the leftovers with alkali, adjusting pH value, acetic ester extraction, decoloring with active carbon; concentrating the mother liquid to a proper volume, precipitating deposit, separating the deposit and drying to get coarse hyodeoxycholic acid; esterifying the coarse product, then doing an addition reaction with benzene, separating the methylhyodeoxycholanate-benzene addition compound; decomposing the addition compound with alkali, adjust pH value, getting the purified deoxycholic acid. The obtained mother liquid can be further extracted to get precious chenodeoxycholic acid. The craft has a lot of material, a low pollution, safety and no poison, a low cost, a high product purity and is suitable for industry production in a large scale.