Small-molecule fluorescence imaging in the second near-infrared (NIR-II, 1000–1700 nm) window has gained increasing interest in clinical application. Till now, very few studies have been exploited in the small-molecule fluorophores with both excitation and emission in the NIR-II window. Inspired by the indocyanine green structure, a series of polymethine dyes with both absorption and emission in the NIR-II window have been developed for NIR-II imaging, providing the feasibility to directly compare optical imaging in the NIR-IIa (1300–1400 nm) subwindow under 1064 nm excitation with that in the NIR-II window under 808 nm excitation. The signal–background ratio and the tumor–normal tissue ratio achieved great improvement under 1064 nm excitation in the imaging of mouse blood pool and U87 glioma tumors. Our study not only introduces a broadband emission fluorophore for both NIR-II and NIR-IIa imaging, but also reveals the advantages of NIR-II excitation over NIR-I in in vivo imaging.