Single-walled carbon nanotubes are particularly attractive for biomedical applications, because they exhibit a fluorescent signal in a spectral region where there is minimal interference from biological media. Although single-walled carbon nanotubes have been used as highly sensitive detectors for various compounds, their use as in vivo biomarkers requires the simultaneous optimization of various parameters, including biocompatibility, molecular recognition, high fluorescence quantum efficiency and signal transduction. Here we show that a polyethylene glycol ligated copolymer stabilizes nearinfrared-fluorescent single-walled carbon nanotubes sensors in solution, enabling intravenous injection into mice and the selective detection of local nitric oxide concentration with a detection limit of 1 mM. The half-life for liver retention is 4 h, with sensors clearing the lungs within 2 h after injection, thus avoiding a dominant route of in vivo nanotoxicology. After localization within the liver, it is possible to follow the transient inflammation using nitric oxide as a marker and signalling molecule. To this end, we also report a spatial-spectral imaging algorithm to deconvolute fluorescence intensity and spatial information from measurements. Finally, we demonstrate that alginate-encapsulated single-walled carbon nanotubes can function as implantable inflammation sensors for nitric oxide detection, with no intrinsic immune reactivity or other adverse response for more than 400 days.