Mutanobactins (MUBs) and their congeners that contain a macrocycle and/or a thiazepane ring are lipopeptides from Streptococcus mutans, a major causative agent of dental caries. Here we show that the C-terminal reductase domain of MubD releases the lipohexapeptide intermediates in an aldehyde form, which enables a spontaneous C-C macrocyclization. In the presence of a thiol group, the macrocyclized MUBs can further undergo spontaneous C-S bond formation and C-C bond cleavage to generate diverse MUB congeners.