Imaging techniques are a vital part of clinical diagnostics, biomedical research and nanotechnology. Optical molecular imaging makes use of relatively harmless, low-energy light and technically straightforward instrumentation. Self-illuminating, chemiluminescent systems are particularly attractive because they have inherently high signal contrast due to the lack of background emission. Currently, chemiluminescence imaging involves short-lived molecular species that are not stored but are instead generated in situ, and they typically emit visible light, which does not penetrate far through heterogeneous biological media. Here, we describe a new paradigm for optical molecular imaging using squaraine rotaxane endoperoxides, interlocked fluorescent and chemiluminescent dye molecules that have a squaraine chromophore encapsulated inside a macrocycle endoperoxide. Squaraine rotaxane endoperoxides can be stored indefinitely at temperatures below -20 °C, but upon warming to body temperature they undergo a unimolecular chemical reaction and emit near-infrared light that can pass through a living mouse.