Aggregation and biofilm formation are critical mechanisms for bacterial resistance to host immune factors and antibiotics. Autotransporter (AT) proteins, which represent the largest group of outer membrane and secreted proteins in Gram-negative bacteria, contribute significantly to these phenotypes. Despite their abundance and role in bacterial pathogenesis, most AT proteins have not been structurally characterized and there is a paucity of detailed information with regard to their mode of action. Here we report the structure-function relationships of Ag43a, a prototypic self-associating AT protein from uropathogenic Escherichia coli. The functional domain of Ag43a displays a twisted L-shaped β-helical structure firmly stabilized by a three-dimensional hydrogen-bonded scaffold. Notably, the distinctive Ag43a L-shape facilitates self-association and cell aggregation. Combining all our data, we define a molecular ‘Velcro-like’ mechanism of AT mediated bacterial clumping, which can be tailored to fit different bacterial lifestyles such as the formation of biofilms.