Sleep is not a luxury. It is a necessity. If people sleep well, they will be more productive and start the morning in an excellent mood. On the other hand, people who don’t sleep well. They start their morning very drowsy irrespective of the other effects on their health. Such as the disturbance of the circadian rhythm and so on. In this paper an automatic hybrid algorithm is developed to analyze sleep quality using basically the EEG (Electroencephalogram) signal and polysomnographic report. The idea behind this is to perform the EEG signal processing in such a way as to be classified according to the sleep stages. Finally, we check if the subject passed through all the sleep cycles or not. in order to carry out this work Python version 3 was used.