A simultaneous recording of electroencephalogram (EEG) and functional magnetic resonance imaging (fMRI) can provide high spatiotemporal information of brain activity. However, a proper analysis of the EEG signals is often hindered by various artifacts. In particular, pulse artifact (PA) induced from the heartbeat of a subject interferes with reliable measurements of the EEG signal. A new PA removal method that takes into account the delay variation between the heartbeat and PA and the window size variation in PA is presented in order to improve the detection and suppression of PA in EEG signals. A PA is classified into either a normal PA or a deformed PA. Only normal PAs are averaged to generate a PA template that is used to remove PAs from the measured EEG signals. The performance of the proposed method was evaluated by simulated data and real EEG measurements from epilepsy patients. The results are compared with those from conventional methods.