The cell wall of gram-positive bacteria can be thought of as representing a unique cell compartment, which contains anchored surface proteins that require specific sorting signals. Some biologically important products are anchored in this way, including protein A and fibronectin binding protein of Staphylococcus aureus and streptococcal M protein. Studies of staphylococcal protein A and Escherichia coli alkaline phosphatase show that the signal both necessary and sufficient for cell wall anchoring consists of an LPXTGX motif, a C-terminal hydrophobic domain, and a charged tail. These sequence elements are conserved in many surface proteins from different gram-positive bacteria. We propose the existence of a hitherto undescribed sorting mechanism that positions proteins on the surface of gram-positive bacteria.