The invention discloses a milk replacer for substituting breast milk before weaning of piglets. The milk replacer includes: 100-200 parts of puffed corn, 150-300 parts of corn powder, 70-150 parts of puffed soya bean powder, 100-200 parts of whey powder, 40-80 parts of fermented soybean meal, 100-200 parts of soybean meal, 20-40 parts of whey concentrate, 10-30 parts of whole-fat milk powder, 10-30 parts of glucose, 20-40 parts of hydrolyzed soya bean protein, 10-20 parts of water-soluble micro-capsule fat powder, 5-10 parts of composite microelements, 1-3 parts of composite vitamin, 0.1-0.3 parts of taurine, 0.3-0.5 parts of chitosan, 0.3-0.5 parts of xylooligosaccharide, 0.02-0.06 parts of HY-D, 2-4 parts of methionine, 1-3 parts of lysine, 2-4 parts of threonine, 0.2-0.4 parts of lactic acid bacteria powder, 0.2-0.4 parts of bifidobacterium powder, and 0.2-0.5 parts of a natural plant extract. The invention also discloses a preparation method of the milk replacer. The components in the milk replacer are combined organically to stimulate the color, flavor and taste of the breast milk, so that the milk replacer is improved in palatability and solves the problem of insufficient nutrient intake of the piglets in the situation of insufficient breast milk.