Cancer immunotherapy has developed rapidly in recent years and stands as one of the most promising techniques for combating cancer. To develop and optimize cancer immunotherapy, it is crucial to comprehend the interactions between immune cells and tumor cells in the tumor microenvironment (TME). The TME is complex, with the distribution and function of immune cells undergoing dynamic changes. There are several research techniques to study the TME, and intravital imaging emerges as a powerful tool for capturing the spatiotemporal dynamics, especially the movement behavior and the immune function of various immune cells in real physiological state. Intravital imaging has several advantages, such as high spatio-temporal resolution, multicolor, dynamic and 4D detection, making it an invaluable tool for visualizing the dynamic processes in the TME. This review summarizes the workflow for intravital imaging technology, multi-color labeling methods, optical imaging windows, methods of imaging data analysis and the latest research in visualizing the spatio-temporal dynamics and function of immune cells in the TME. It is essential to investigate the role played by immune cells in the tumor immune response through intravital imaging. The review deepens our understanding of the unique contribution of intravital imaging to improve the efficiency of cancer immunotherapy.