Temperature is one of the most fundamental physical properties to characterize various physical, chemical, and biological processes. Even a slight change in temperature could have an impact on the status or dynamics of a system. Thus, there is a great need for high-precision and large-dynamic-range temperature measurements. Conventional temperature sensors encounter difficulties in high-precision thermal sensing on the submicron scale. Recently, optical whispering-gallery mode (WGM) sensors have shown promise for many sensing applications, such as thermal sensing, magnetic detection, and biosensing. However, despite their superior sensitivity, the conventional sensing method for WGM resonators relies on tracking the changes in a single mode, which limits the dynamic range constrained by the laser source that has to be fine-tuned in a timely manner to follow the selected mode during the measurement. Moreover, we cannot derive the actual temperature from the spectrum directly but rather derive a relative temperature change. Here, we demonstrate an optical WGM barcode technique involving simultaneous monitoring of the patterns of multiple modes that can provide a direct temperature readout from the spectrum. The measurement relies on the patterns of multiple modes in the WGM spectrum instead of the changes of a particular mode. It can provide us with more information than the single-mode spectrum, such as the precise measurement of actual temperatures. Leveraging the high sensitivity of WGMs and eliminating the need to monitor particular modes, this work lays the foundation for developing a high-performance temperature sensor with not only superior sensitivity but also a broad dynamic range.