Stroke ranks second as the leading cause of death globally, with disability being the primary accompanying factor. The cause of death in stroke patients is due to the lack of an optimal stroke prediction system; therefore, identifying whether a patient is experiencing a stroke or not becomes the focus of this research. Thus, the objective of this study is to compare the performance of stroke prediction using two classification models, namely K-Nearest Neighbors (KNN) and Support Vector Machine (SVM), with and without using the GridSearchCV optimization technique. In this experiment, the dataset is processed and divided into training and testing data using the SMOTE oversampling technique. Initial testing is conducted without GridSearchCV. The results of the initial testing show that the KNN model performs better than SVM, with accuracies of 91% and 83%, respectively. After optimizing parameters using GridSearchCV, both models experience a significant performance improvement. The KNN model increases accuracy to 95% with precision of 91% and recall of 98%, while the SVM model increases accuracy to 94% with precision of 90% and recall of 99%. These results indicate that using GridSearchCV to optimize parameters of KNN and SVM models can significantly enhance stroke prediction performance. There are differences in precision and recall between KNN and SVM. The KNN model tends to have higher recall, while the SVM model has higher precision, and for accuracy, the KNN algorithm outperforms SVM in stroke prediction.