There are two  methods for the production of spiropyrans. The first one can be by condensation of methylene bases with o-hydroxy aromatic aldehydes (or the condensation of the precursor of methylene bases). Spiropyrans generally could be obtained by boiling the aldehyde and the respective benzazolium salts in presence of pyridine or piperidine. The general formula of the synthesis of spiropyrans is shown in the Figure 1.
The second way is by condensation of o-hydroxy aromatic aldehydes with the salts of heterocyclic cations which contains active methylene groups and isolation of the intermediate styryl salts. This second procedure is followed by the removal of the elements of the acid from the obtained styryl salt, such as perchloric acid, with organic bases (gaseous ammonia or amines).