Encapsulation is crucial for constructing hydrogel bioelectronics for detecting bioelectric signals and applying electrical stimulation. However, introducing an extra encapsulating layer in bioelectrodes can lead to complex fabrication processes, reduced conductivity, and compromised mechanical performance. Here, we develop a one-step strategy of controllable construction for self-encapsulated hydrogel bioelectrodes (SHBs) for arrhythmic management. By utilizing the nonsolvent-induced phase separation-like (NIPS-like) method, acrylamide facilitates the phase separation of the PEDOT chains and the PSS chains, leading to the formation of SHBs with a conducting layer coated by an encapsulating layer. SHBs exhibit high conductivity (309.73 ± 15.05 S m−1), bright stretchability (exceeding 300 %), and tissue-like Young's modulus (16.33 ± 1.58 kPa), simultaneously. Therefore, SHBs can record the different components of atrial and ventricular excitation in vivo without filtering, and keep a smooth baseline in long-time electrocardiogram of the rat. Moreover, SHBs can stimulate the arrhythmic heart, restoring it to a normal rhythm. Our finding provides a way to promote the detection and modulation application of hydrogel electrodes in bioelectronics.