Visualizing biomolecules such as enzymes in the deep tissue of living organisms via molecular ratiometric fluorescent probes in the second near-infrared window (NIR-II) with a built-in self-calibration function can provide reliable information about relevant pathophysiological processes directly but so far is not feasible due to the lack of a fluorescence modulation strategy in the NIR-II window. Here we present a molecular platform Py-2 by integrating the rhodamine 6G scaffold and polymethine. The maximal emission wavelength of Py-2 was 1010 nm and blue-shifted to 945 nm when its secondary amine was acylated. Based on Py-2, two molecular ratiometric NIR-II fluorescent probes, nitroreductase-responsive Rap-N and ROS-responsive Rap-R, were constructed and successfully demonstrated in vitro and in vivo. Overall, this report presents a unique approach to developing ratiometric NIR-II molecular probes for in vivo biosensing.