The invention relates to the technical field of pig fodder, in particular to a method for fermenting pig fodder through microbial flora. According to the method, raw materials such as bean pulp, ricebran, sweet potato residues, distillers' grains, corn flour and Chinese herbal medicine powder are fermented through the microbial flora for making the pig fodder, through the fermentation, the conversion efficiency of the fodder is increased, the quality of the fodder is improved, the taste of the fodder is improved, so that the fodder becomes crisp and soft, and the palatability is improved; meanwhile, the content of antinutritional factors and harmful microorganisms in the raw materials is lowered, and the breeding cost is lowered. The made pig fodder is good in palatability and convenientto digest, feeding of the fine fodder is reduced, the cost is lowered, weight increase of live pigs is effectively promoted, and the pork quality is improved, so that the pork is fresh, tender and delicious. After the pigs eat the fodder, the immunity of the pigs is improved, diseases are reduced, the appetite can be improved, the intake amount is increased, and the pork quality is improved.