Timely detection of anomalies and automatic interpretation of an electrocardiogram (ECG) play a crucial role in many healthcare applications, such as patient monitoring and post treatments. Beat-wise segmentation is one of the essential steps in ensuring the confidence and fidelity of many automatic ECG classification methods. In this sense, we present a reliable ECG beat segmentation technique using a CNN model with an adaptive windowing algorithm. The proposed adaptive windowing algorithm can recognise cardiac cycle events and perform segmentation, including regular and irregular beats from an ECG signal with satisfactorily accurate boundaries.The proposed algorithm was evaluated quantitatively and qualitatively based on the annotations provided with the datasets and beat-wise manual inspection. The algorithm performed satisfactorily well for the MIT-BIH dataset with a 99.08% accuracy and a 99.08% of F1-score in detecting heartbeats along with a 99.25% of accuracy in determining correct boundaries. The proposed method successfully detected heartbeats from the European S-T database with a 98.3% accuracy and 97.4% precision. The algorithm showed 99.4% of accuracy and precision for Fantasia database. In summary, the algorithm’s overall performance on these three datasets suggests a high possibility of applying this algorithm in various applications in ECG analysis, including clinical applications with greater confidence.