Automatic detection of QRS onset and offset points with reasonable accuracy has been a difficult task, approached since the first attempts at computerised electrocardiogram interpretation. The problem is additionally complicated by the usual presence of power-line interference, electromyogram artefacts and baseline fluctuation in the original signal, especially in multiphase complexes with small q, r, r', or s' waves. We propose a preprocessing method guaranteeing accurate preservation of the QRS boundaries, even in the existence of strong power-line or electromyogram noise. Examples of detection of QRS onset and offset points and a comparison with observer markings are presented for the assessment of preprocessing efficiency and detection consistency.