Network security is becoming increasingly critical with the rising complexity of cyber attacks. Intrusion Detection Systems (IDS) play a crucial role in monitoring and identifying suspicious activities in real-time. This study compares two machine learning algorithms, Support Vector Machine (SVM) and K-Nearest Neighbors (KNN), in detecting attacks using the KDD Cup 99 dataset. The experimental results show that KNN outperforms SVM in terms of accuracy, precision, recall, and F1-score. KNN is more effective in classifying overall data, while SVM is efficient in managing false positives and handling high-dimensional data. Both algorithms have their respective strengths and weaknesses, so the choice of algorithm should be tailored to the specific characteristics of the data and detection requirements. This research provides valuable insights into selecting the appropriate algorithm to enhance the effectiveness of network intrusion detection in the future.