BackgroundCancer is a severe threat to human health, and surgery is a major method of cancer treatment. This study aimed to develop an optical sensor for fast cancer tissue.MethodsThe tissue autofluorescence spectrum and diffuse reflectance spectrum were obtained by using a laboratory‐developed optical sensor system. A total of 151 lung tissue samples were used in this ex vivo study.ResultsExperimental results demonstrate that tissue autofluorescence spectroscopy with a 365‐nm excitation has better performance than diffuse reflectance spectroscopy, and 63 of 64 test samples (98.4% accuracy) were correctly classified with tissue autofluorescence spectroscopy and our developed data analysis method.ConclusionsOur promising ex vivo study results show that the developed optical sensor system has great promise for future clinical translation for intraoperative lung cancer detection and other applications.