Epitaxial strain energies of epitaxial films and bulk superlattices are studied via first-principles total energy calculations using the local-density approximation. Anharmonic effects due to large lattice mismatch, beyond the reach of the harmonic elasticity theory, are found to be very important in Cu/Au (lattice mismatch 12%), Cu/Ag (12%) and Ni/Au (15%). We find that 001 is the elastically soft direction for biaxial expansion of Cu and Ni, but it is 201 for large biaxial compression of Cu, Ag, and Au. The stability of superlattices is discussed in terms of the coherency strain and interfacial energies. We find that in phase-separating systems such as Cu-Ag the superlattice formation energies decrease with superlattice period, and the interfacial energy is positive. Superlattices are formed easiest on (001) and hardest on (111) substrates. For ordering systems, such as Cu-Au and Ag-Au, the formation energy of superlattices increases with period, and interfacial energies are negative. These superlattices are formed easiest on (001) or (110) and hardest on (111) substrates. For NiAu we find a hybrid behavior: superlattices along 111 and 001 behave like in phase-separating systems, while for 110 they behave like in ordering systems. Finally, recent experimental results on epitaxial stabilization of disordered Ni-Au and Cu-Ag alloys, immiscible in the bulk form, are explained in terms of destabilization of the phase separated state due to lattice mismatch between the substrate and constituents.