Credit card fraud has become a significant threat to individuals, financial institutions, businesses, and governments, causing substantial annual economic losses through increasingly sophisticated fraudulent activities. This research aims to enhance credit card fraud detection by leveraging machine learning algorithms and ensemble learning techniques to improve detection accuracy and model robustness. Various supervised machine learning algorithms were implemented, including Decision Tree (DT), Logistic Regression (LR), Naïve Bayes (NB), Random Forest (RF), Artificial Neural Network (ANN), and Extreme Gradient Boosting (XGBoost). To address the issue of highly imbalanced datasets, multiple resampling techniques were applied, including Random Under-Sampling (RUS), Random Over-Sampling (ROS), and Synthetic Minority Over-Sampling Technique (SMOTE). Feature selection and data preprocessing techniques were also incorporated to improve model performance. The models were evaluated using several performance metrics, including accuracy, precision, recall, F1-score, and Area Under the Curve (AUC). Additional optimization was performed through threshold variation on the best-performing models, namely Random Forest and XGBoost. Furthermore, ensemble learning techniques, including bagging, boosting, and stacking, were employed to enhance fraud prediction capability and improve model generalization. The results demonstrated that the ensemble learning models significantly improved fraud detection performance compared to standalone models. Among the evaluated approaches, the bagging ensemble technique achieved the best overall performance, obtaining 0.99 accuracy, 0.90 recall, and 0.77 precision. The ensemble model combined Decision Tree, Random Forest, and Artificial Neural Network base learners using different resampling techniques, which increased model diversity and robustness. The proposed approach also maintained strong performance when evaluated on unseen datasets, demonstrating its generalization capability. The findings indicate that integrating ensemble learning, resampling strategies, and multiple machine learning models can substantially improve credit card fraud detection systems. The proposed framework provides a robust and scalable approach for detecting fraudulent transactions while maintaining high predictive performance in real-world imbalanced financial datasets.