The bacterial SOS response stands as a paradigm of gene networks controlled by a master transcriptional regulator. Self-cleavage of the SOS repressor, LexA, induces a wide range of cell functions that are critical for survival and adaptation when bacteria experience stress conditions1, including DNA repair2, mutagenesis3,4, horizontal gene transfer5–7, filamentous growth, and the induction of bacterial toxins8–12, toxin-antitoxin systems13, virulence factors6,14, and prophages15–17. SOS induction is also implicated in biofilm formation and antibiotic persistence11,18–20. Considering the fitness burden of these functions, it is surprising that the expression of LexA-regulated genes is highly variable across cells10,21–23 and that cell subpopulations induce the SOS response spontaneously even in the absence of stress exposure9,11,12,16,24,25. Whether this reflects a population survival strategy or a regulatory inaccuracy is unclear, as are the mechanisms underlying SOS heterogeneity. Here, we developed a single-molecule imaging approach based on a HaloTag fusion to directly monitor LexA inside live Escherichia coli cells, demonstrating the existence of 3 main states of LexA: DNA-bound stationary molecules, free LexA and degraded LexA species. These analyses elucidate the mechanisms by which DNA-binding and degradation of LexA regulate the SOS response in vivo. We show that self-cleavage of LexA occurs frequently throughout the population during unperturbed growth, rather than being restricted to a subpopulation of cells, which causes substantial cell-to-cell variation in LexA abundances. LexA variability underlies SOS gene expression heterogeneity and triggers spontaneous SOS pulses, which enhance bacterial survival in anticipation of stress.