Lower urinary tract infection (UTI) is common but only rarely complicated by pyelonephritis. However, the mechanisms preventing extension to the kidney are unclear. Here, we identified neutrophil extracellular traps (NETs) in healthy human urine that provide an antibacterial defense strategy within the urinary tract. In both in vivo murine models of UTI where uropathogenic E. coli are inoculated into the bladder and ex vivo human urine models, NETs interacted with uromodulin to form large webs that entrapped the bacteria. Peptidyl arginine deiminase 4 (PADI4) inhibition in mice blocked NETosis and resulted in progression of cystitis into pyelonephritis, suggesting that NETosis of urinary neutrophils acts to prevent bacterial ascent into the kidney. Analysis of UK Biobank data revealed that genetic variants in PADI4 that associated with increased risk of rheumatoid arthritis in multiple genome-wide association studies were consistently associated with reduced susceptibility to UTI. Last, we showed that urine dipstick testing for leukocyte esterase was negative in the presence of intact blood neutrophils but became positive when neutrophils were stimulated to NET, and this could be prevented by selective PADI4 inhibition, demonstrating that this test does not detect absolute neutrophil count, as has long been assumed, but specifically detects neutrophils that have undergone NETosis. These findings highlight the role of NETosis in preventing ascending infections in the urinary tract and improve our understanding of one of the most common clinical tests in medicine.