Electrocardiogram (ECG) is the recording of electric activity of heart. The abnormal ECGs are called arrhythmias. In this paper, we propose the algorithm to detect the arrhythmias based on heart rate variability. Heart rate variability in normal ECGs and arrhythmias is detected by taking five ECG beats from each ECG. We investigate the consecutive RR peak interval to detect heart rate variation in Arrhythmias. It is found that in arrhythmias, consecutive RR interval is varying, while in normal ECGs, RR peak interval is almost constant. Heart rate variation in normal ECGs are up to 7.5%. ECG analysis by proposed algorithm has done on MATLAB (R2011a).