Breast cancer is a disease commonly suffered by women worldwide, ranking as the second-largest disease burden. In response to the urgent need for improved detection accuracy, Convolutional Neural Networks (CNNs) promise significant advancements. The objective of this research is to optimize the use of CNNs with the DenseNet architecture for breast cancer detection. The study employs quantitative methods, leveraging Deep Learning through CNNs. Mammography data is sourced from Kaggle, specifically the “Breast Histopathology Images” dataset. This dataset comprises 90,000 digital mammography images, which are preprocessed and divided proportionally for training, validation, and model testing. Research variables encompass CNN model parameters, training techniques, and the integration of imaging modalities to enhance breast cancer detection performance. The research focuses on processed mammography data, with accuracy and image quality as key evaluation metrics for breast cancer sample identification. Our findings demonstrate that the DenseNet architecture within CNNs achieves an impressive 92% accuracy in breast cancer detection. This remarkable performance signifies success in enhancing image quality and class prediction, aligning with the DenseNet architecture’s flow diagram. Ultimately, these results contribute significantly to effective breast cancer diagnosis by optimizing CNNs with the DenseNet architecture to improve image quality during breast cancer sampling.