• Optimization of solid-phase extraction for biocidal oligoguanidines from water samples. • Quantitation by liquid chromatography hyphenated with mass spectrometry. • Detection limits in the sub-μgL−1 range allow residue analysis in the environment. • Selection of appropriate markers for complex mixtures of oligoguanidines.