Abstract Spectral analysis is now a standard procedure for analyzing the electroencephalograms (EEG) obtained by polysomnographic recordings. These numerical methods assume an artifact-free EEG since artifacts create spurious spectral components. Our aim was the development of a QRS artifact removal technique that might be applied to full night EEG with a minimal human intervention. This technique should handle one EEG channel, with or without use of one ECG channel. Variance minimization, independent component analysis (ICA), morphological filters (MF) have been implemented. Careful attention has been given to define the MF structuring element. The tests on artifact-simulated and real data were checked on the residual ECG spectral components present in the cleaned EEG. The best results are obtained by the MF when the structuring element is an artifact template defined either directly on the EEG or on the ICA ECG component. Further developments are required to identify and subtract the T-wave artifacts.