The invention relates to a lead-free solder alloy for welding the electronic elements and its manufacturing method. The lead-free solder alloy is characterized in that the main components are Sn, Ag, Cu, and Ni, and In, Bi, Pd, P, Ge, Ga, Se, Te, La, Ce, Pr, Nd, Pm, Sm, Eu, Tm are added selectively. The preparation method is characterized by taking Sn, Ag, Cu, Ni and the additional elements in proportion and smelting them at the temperature of 1300 C. to 1500 C. to obtain the intermediate alloy by using water glass covering process; melting the residual Sn and the intermediate alloy at the temperature of 300 C. to 350 C. by using water glass covering process, and casting the molten materials into alloy pig and soldering tin rod at the temperature of between 250 C. and 350 C.. The lead-free solder alloy provided by the invention can be used for welding the Ag and Pd noble metal electronic element.