The role of surface loops in encoding SH2 domain specificity has been systematically investigated by characterizing a group of loop variants obtained from screening phage-displayed SH2 domain libraries. The reported results support a general role for the EF loop (which connects the β-strands E and F) and the BG loop (which connects the α-helix B and β-strand G) in encoding SH2 specificity, add to our understanding of the mechanism of target sequence recognition by an SH2 domain in cells, and have general implications for the evolution of binding specificity of protein interaction modules.