pH switchable zwitterionic polymers was proposed for detection of Gram positive and Gram negative bacteria. Fluorescence on/off dependent on pH was achieved due to hydrophilic hydrophobic nature of zwitterionic fluorescent polymer. Ionic complex interaction between negative charge bacteria and positive charge polymer showed good stability. The zwitterionic fluorescent polymer can be used in broad detection of bacteria in different pH conditions.