Thus, to effectively solve the problem of eliminating the ECG baseline drift, it is necessary to filter the ECG signal. In this study for solve the problem of eliminating the ECG baseline drift, various filters were used: a low-pass filters based on the forward and inverse discrete Fourier transform, Butterworth filter, median filter, Savitsky-Golay filter. The results obtained confirmed the efficiency of filtering harmonic noise based on forward and backward DFT on real data. The method makes it possible to implement a narrow-band stop filter in the range from 0 to the Nyquist frequency. In this case, the notch band can be less than 0.1% of the Nyquist frequency, which is important when processing ECG signals.The filtering result was evaluated by the appearance of the filtered ECG. The evaluation criterion was the presence on the signal of characteristic fragments reflecting the work of the atria and ventricles of the heart in the form of a P wave, a QRS complex and a ST-T segment. A new method has been developed for filtering the ECG signal, which is based on the use of a sliding window containing 5 points. A linear function is constructed from a sample of five points using the least squares method. The value of the resulting linear function at the midpoint is used as the new value. Several iterations are performed to achieve a good result. To eliminate the baseline drift for the ECG fragment, it is proposed to use a special cubic interpolation spline. The algorithm for constructing the used spline requires solving a system of equations with a tridiagonal matrix.