Sortases are a group of enzymes displayed on the cell-wall of Gram-positive bacteria. They are responsible for the attachment of virulence factors onto the peptidoglycan in a transpeptidation reaction through recognition of a pentapeptide substrate. Most housekeeping sortases recognize one specific pentapeptide motif; however, Streptococcus pyogenes sortase A (SpSrtA WT) recognizes LPETG, LPETA and LPKLG motifs. Here, we examined SpSrtA's flexible substrate specificity by investigating the role of the β7/β8 loop in determining substrate specificity. We exchanged the β7/β8 loop in SpSrtA with corresponding β7/β8 loops from Staphylococcus aureus (SaSrtA WT) and Bacillus anthracis (BaSrtA WT). While the BaSrtA-derived variant showed no enzymatic activity toward either LPETG or LPETA substrates, the activity of the SaSrtA-derived mutant toward the LPETA substrate was completely abolished. Instead, the mutant had an improved activity toward LPETG, the preferred substrate of SaSrtA WT.