Nitrite and sulfite play important roles in human health and environmental science, so it is desired to develop a facile and efficient method to evaluate NO2- and SO32- concentrations. In this article, the use of green alternatives with the potential of multi-functionality has been synthesized to detect nitrite and sulfite based on fluorescent probe. The carbon dots (CDs) with starch as only raw materials show fluorescence turn “on-off-on” response towards NO2- and SO32- with the limits of detection of 0.425 and 0.243 μМ, respectively. Once nitrite was present in the solution, the fluorescence of CDs was quenched rapidly due to the charge transfer. When sulfite was introduced, the quenching fluorescence of CDs was effectively recovered because of the redox reaction between NO2- and SO32-, and thus providing a new way for NO2- and SO32- detection. Owing to their excellent analytical characteristics and low cytotoxicity, the “on-off-on” sensor was successfully employed for intracellular bioimaging of NO2- and SO32-.