Aim The aim of this work was to develop a simple computer-based sleep-scoring algorithm to detect the three vigilance states-rapid eye movement (REM) sleep, non-REM (NREM) sleep, and wakefulness-using the entire frequency domain with relative thresholds. Methods A variety of frequencies and time-domain features were extracted from each 4-s epoch in retrospective 24-h sleep data sets from mice using an algorithm developed in Matlab version 7.0. This algorithm is composed of five steps: (1) determining the EMG-power ratio, (2) determining the three energy areas (high, middle, and low) using EMG-power ratio thresholds (e.g., 5.5 and 6), (3) determining the h/d ratio, (4) distinguishing wakefulness from NREM sleep using the h/d ratio in the middle-energy area, and (5) distinguishing REM from NREM sleep using the h/d ratio in the low-energy area. Results We were able to achieve a high degree (92%) of agreement between the results of this algorithm and the results of a waveform-recognition procedure.Conclusion This algorithm should overcome the inconsistencies inherent in manual scoring and reduce the time required for expert analysis. This algorithm is a reliable and efficient tool for automated detection of the three vigilance states.