It has been known that although two elemental metals of Pb and Sn are immiscible, they can form alloys on surfaces of other metal Z. In order to understand such surface alloying, we study the stability of ordered alloys, PbZ and SnZ, in several structures by analyzing modified formation energies that enhance the energy difference between metastable structures. We demonstrate that the Pb-Sn alloying on Rh(111) and Ru(0001) surfaces observed in previous experiments can be explained as the stability of PbZ and SnZ in the B2 structure. Based on this concept, 14 metal substrates are predicted to yield Pb-Sn alloys.