Spiropyran salts containing a cationic vinyl‐3H‐indolium moiety are characterized by NIR absorption and fluorescence of their merocyanine forms. This feature makes them promising fluorescent probes and markers for bioimaging. The article focuses on the synthesis and study of the spectral, kinetic and toxic characteristics of such compounds with respect to various substituents in different moieties and the type of anion. A detailed analysis of the acquired data made it possible to draw some important conclusions regarding the influence of structural factors, which will be very useful for the further rational design of such derivatives. In particular, it was shown that the counterion has minimal effect on the spectral and kinetic characteristics of the dyes but dramatically affects the toxicity of the compounds. Following selection of the most appropriate compounds, bioimaging experiments were carried out to visualize planktonic bacteria and bacterial biofilms of E. coli and A. calcoaceticus. The ability to visualize biofilms is critical for the diagnosis of chronic diseases. By the results of molecular docking a theoretical interaction pattern between spiropyran molecules and DNA was proposed.