A respiratory gas analyzer for evaluating a respiratory gas, wherein the respiratory gas analyzer is configured to obtain at least one respiratory gas parameter of the respiratory gas from a measuring system or comprises at least one measuring unit which is configured to determine at least one respiratory gas parameter from the respiratory gas, wherein the respiratory gas analyzer comprises: - at least one pre-processing unit which is configured to evaluate the at least one determined or provided respiratory gas parameter and to determine at least one respiratory gas signal, wherein the at least one respiratory gas signal is a respiratory gas volume of a current breath and the pre-processing unit is configured to normalize a current respiratory gas volume per breath as a percentage of a normal value of an inspiratory respiratory minute volume of a specific time in order to determine a normalized value, in particular a normalized respiratory gas volume; - at least one temporary storage unit which is configured to temporarily store the normalized value; - at least one detector unit which is configured to determine at least one stage of sleep from at least one temporarily stored normalized value, wherein the detector unit is configured to determine a deviation of the normalized value from the normal value, to filter the determined deviation with a low pass, to reproduce the value smoothed in this manner as a respiratory disturbance index corresponding to the deviation, and to assign a current breath to a stage of sleep according to the determined value of the respiratory disturbance index or according to a stability level as a reciprocal of the respiratory disturbance index; - at least one integrator unit which is configured to determine a quality of sleep based on the at least one stage of sleep determined by means of the detector unit, wherein the integrator unit is configured, at the end of a measuring period, to add up the times and proportions of the measuring period during which the respiratory disturbance index was in the range for deep sleep, light sleep, REM sleep, or waking state, and to determine the quality of sleep based on the duration of the detected deep sleep. - at least one pre-processing unit which is configured to evaluate the at least one determined or provided respiratory gas parameter and to determine at least one respiratory gas signal, wherein the at least one respiratory gas signal is a respiratory gas volume of a current breath and the pre-processing unit is configured to normalize a current respiratory gas volume per breath as a percentage of a normal value of an inspiratory respiratory minute volume of a specific time in order to determine a normalized value, in particular a normalized respiratory gas volume; - at least one temporary storage unit which is configured to temporarily store the normalized value; - at least one detector unit which is configured to determine at least one stage of sleep from at least one temporarily stored normalized value, wherein the detector unit is configured to determine a deviation of the normalized value from the normal value, to filter the determined deviation with a low pass, to reproduce the value smoothed in this manner as a respiratory disturbance index corresponding to the deviation, and to assign a current breath to a stage of sleep according to the determined value of the respiratory disturbance index or according to a stability level as a reciprocal of the respiratory disturbance index; - at least one integrator unit which is configured to determine a quality of sleep based on the at least one stage of sleep determined by means of the detector unit, wherein the integrator unit is configured, at the end of a measuring period, to add up the times and proportions of the measuring period during which the respiratory disturbance index was in the range for deep sleep, light sleep, REM sleep, or waking state, and to determine the quality of sleep based on the duration of the detected deep sleep.