The growth of digital services has increased the risk of malicious URLs, such as those used for phishing, malware, and website defacement, making rapid and accurate detection mechanisms essential. This study aims to evaluate the performance of five machine learning algorithms Logistic Regression, Decision Tree, Random Forest, HistGradient Boosting, and Gaussian Naive Bayes, in classifying URLs into four classes using lexical features extracted directly from the URL structure. The dataset used is the Malicious URLs Dataset from Kaggle, which, after preprocessing, yielded 641,113 URLs. Each URL was transformed into 25 lexical features, and the data was then split using a stratified split with an 80:20 ratio. Evaluation was conducted using the metrics accuracy, precision, recall, macro F1-score, and confusion matrix, along with an experiment involving the removal of protocol features to analyze its impact on model performance. The results showed that Random Forest delivered the best performance with an accuracy of 94.98% and a macro F1-score of 93.03%, outperforming the other algorithms tested. Protocol feature removal reduced the performance of all models; however, Random Forest maintained a high level of accuracy, indicating that the combination of lexical features effectively represents the characteristics of URLs. These findings indicate that an approach based on lexical features and Random Forest has the potential to be a lightweight, efficient, and reliable solution for supporting the multi-class detection of malicious URLs in cybersecurity systems.
Copyrights © 2026