The glycosyltransferase PglH transfers three terminal N-acetylgalactosamine (GalNAc) residues to a carrier, which is a prerequisite for bacterial protein N-glycosylation. Here authors present the crystal structures of PglH in three distinct states and show that a ‘ruler helix’ facilitates membrane attachment and glycan counting.