The human heart is an efficient electromechanical pump which provides oxygen and nutrients to all human organs. Each heartbeat is ignited and synchronized by an electrical action potential initiating and rapidly propagating through the heart's electrical system. Cardiovascular diseases, a leading cause of death in humans, disrupt this synchronous excitation. Heart rhythm disorders, known as arrhythmias, are particularly deadly. Cardiac arrhythmias are primarily treated by implantable pacemakers and defibrillators because pharmacological treatments are mostly ineffective. In this work, we report on graphene-only cardiac pacemakers as advanced cardiac biointerfaces. Leveraging sub-micrometer thick tissue-conformable graphene arrays, we are able to sense from and stimulate the heart, altering its functions, suggesting that the devices can be used for high-density functional interfacing with the heart. The arrays show effective electrochemical properties, namely interface impedance down to 40 Ohm x cm2, charge storage capacity up to 63.7 mC/cm2, and charge injection capacity up to 704 uC/cm2. Transparency of the structures allows for simultaneous optical mapping of cardiac action potentials and calcium transients while performing electrical measurements. Upon validating the graphene-based cardiac pacing in ex vivo mouse hearts, we performed in vivo cardiac pacing in a rat model with clinically induced arrhythmia. The condition was successfully diagnosed and treated using graphene biointerfaces.