Numerous methods have been reported for deriving respiratory information such as respiratory rate from the electrocardiogram (ECG). In this paper the authors present a real-time algorithm for estimation and removal of baseline wander (BW) noise and obtaining the ECG-derived respiration (EDR) signal for estimation of a patient's respiratory rate. This algorithm utilizes a real-time "T-P knot" baseline wander removal technique which is based on the repetitive backward subtraction of the estimated baseline from the ECG signal. The estimated baseline is interpolated from the ECG signal at midpoints between each detected R-wave. As each segment of the estimated baseline signal is subtracted from the ECG, a "flattened" ECG signal is produced for which the amplitude of each R-wave is analyzed. The respiration signal is estimated from the amplitude modulation of R-waves caused by breathing. Testing of the algorithm was conducted in a pseudo real-time environment using MATLAB™, and test results are presented for simultaneously recorded ECG and respiration recordings from the PhysioNet/PhysioBank Fantasia database. Test data from patients were chosen with particularly large baseline wander components to ensure the reliability of the algorithm under adverse ECG recording conditions. The algorithm yielded EDR signals with a respiration rate of 4.4 breaths/min. for Fantasia patient record f2y10 and 10.1 breaths/min. for Fantasia patient record f2y06. These were in good agreement with the simultaneously recorded respiration data provided in the Fantasia database thus confirming the efficacy of the algorithm.