In the human body, carboxylesterases (CEs) play crucial roles in xenobiotic metabolism and lipid homeostasis. But abnormal expression of CEs is highly associated with some diseases, such as hyperlipidemia, diabetes, and liver cancer. Therefore, it is of great importance to develop an efficient tool for the accurate detection of CEs in living organisms. Herein, an innovative near-infrared (NIR) fluorescent probe, TTAP-AB, was designed for CE detection based on the aggregation-induced emission (AIE) mechanism. This probe exhibits rapid response (2 min), excellent sensitivity (limit of detection = 8.14 × 10-6 U/mL), and high selectivity to CEs. Additionally, owing to its good biocompatibility, the TTAP-AB probe enables the monitoring of dynamic changes in CE levels under drug-induced modulation in living cells and zebrafish. More importantly, the TTAP-AB probe was successfully employed to image liver tumors and assist in tumor resection through the real-time monitoring of CEs, indicating that TTAP-AB is promising to guide liver cancer surgery. Therefore, the TTAP-AB probe can not only enrich the strategies for CE detection in biological systems but also has great potential for some clinical imaging applications, including medical diagnosis, preclinical research, and imaging-guided surgery.