Respiratory rate (RR) is an important biomarker of cardiopulmonary status. Its role is particularly evident in conditions like obstructive sleep apnea, which significantly increase risk of heart disease. Electrocardiogram (ECG)-derived RR is an emerging alternative to traditional RR measurement, which requires cumbersome and specialized equipment. Here, we developed a novel algorithm to estimate instantaneous RR using only single-lead body-surface ECG. We comprehensively tested the influence of sex, age, and body mass index on the efficacy of ECG-derived RR. ECG and RR waveforms were obtained from 50 patients enrolled in a polysomnography sleep study. Algorithm-based ECG-derived RR estimates were compared with reference RR measurements from the sleep study. A close linear correlation between the reference and algorithmic RR estimates was observed across the entire cohort of patients. The mean absolute RR estimation error was 0.8±0.9 breaths/min. Importantly, the algorithm's accuracy was independent of the patient's age, sex, and body habitus. Our algorithm provides a robust estimation of RR and holds promise for remote pulmonary assessment in patients with respiratory disorders.