Background: This study introduces a prediction system for lung cancer that uses the K-Nearest Neighbors (KNN) algorithm, one of the most important cancer-related diseases worldwide. Early detection and prediction can significantly improve survival rates. This study is one of the leading causes of cancer death worldwide. Objective: This study aims to develop a prediction system for lung cancer utilizing the K-Nearest Neighbors (KNN) algorithm, addressing the critical need for early detection in combating one of the leading causes of cancer-related mortality worldwide. Method: Leveraging a dataset comprising 10,000 patient records encompassing demographics, medical history, and radiographic features, we conducted preprocessing and normalization before training, validating, and testing the KNN model. Optimal parameter selection facilitated the achievement of a 95% accuracy rate in predicting lung cancer, highlighting the efficacy of KNN in this context. Findings: Our study underscores the potential of machine learning, specifically KNN, in enhancing medical diagnostics. By integrating machine learning techniques into medical practice, we can facilitate early detection and prompt intervention, thereby potentially improving patient outcomes. Novelty: This research contributes to the ongoing integration of machine learning into medical diagnostics, particularly in the realm of cancer prediction. Our findings demonstrate the utility of KNN in accurately predicting lung cancer, thereby offering a promising avenue for enhancing early detection strategies. Result and Discussion: The effectively demonstrate the potential of the K-Nearest Neighbors (KNN) algorithm in achieving a remarkable accuracy rate of 95.0% in predicting lung cancer, as evidenced by rigorous preprocessing and optimization of a dataset comprising 10,000 patient records. The integration of machine learning techniques, exemplified by the KNN algorithm, holds significant promise for improving early detection and subsequent treatment outcomes in lung cancer. By leveraging large datasets and advanced algorithms, we can pave the way for more effective diagnostic tools in combating this devastating disease. Keywords: K-Nearest Neighbors (KNN), Support Vector Machine (SVM), Random Forest (RF), Decision Tree (DT), Lung cancer detection, Medical imaging, Early diagnosis, Machine learning, Patient outcomes