LysM is a highly conserved carbohydrate binding module that is present in proteins from all kingdoms, but how LysM binds its substrates is unknown. Mesnage et al. now show how a LysM domain from AtlA, an autolysin from Enterococcus faecalis, recognizes peptidoglycan. By constructing protein variants that contained a varying number of LysM modules, the authors showed that each module could bind peptidoglycan independently, and that the binding capacity increased with the number of LysM modules. By varying the composition of peptidoglycan, they demonstrated that LysM recognizes a specific motif that includes N-acetylglucosamine (GlcNAc) repetitions — GlcNAc-X-GlcNAc. Free and bound LysM structures were solved by NMR, which revealed a pocket responsible for binding to one of the GlcNAc N-acetyl groups. Furthermore, the peptidoglycan peptide stems were located in shallow grooves at the surface of LysM, on both sides of the glycan backbone, suggesting that these peptide stems modulate the binding of peptidoglycan to LysM and might allow LysM to discriminate between different binding substrates.