In many locations, reverse transcription polymerase chain reaction (RT-PCR) tests are used to identify COVID-19. It could take more than 48 h. It is a key factor in its seriousness and quick spread. Images from chest X-rays are utilized to diagnose COVID-19. Which generally deals with the issue of imbalanced classification. The purpose of this paper is to improve CNN’s capacity to display Chest X-ray pictures when there is a class imbalance. CNN Training has come to an end while chastening the classes for using more examples. Additionally, the training data set uses data augmentation. The achievement of the suggested method is assessed on an image’s two data sets of chest X-rays. The suggested model’s efficiency was analyzed using criteria like accuracy, specificity, sensitivity, and F1 score. The suggested method attained an accuracy of 94% worst, 97% average, and 100% best cases, respectively, and an F1-score of 96% worst, 98% average and 100% best cases, respectively.