A defibrillator is a small device placed in a person's heart to detect abnormal heartbeats and restore a normal rhythm through electrical shocks if needed. It works like a small computer, monitoring a person's heartbeat and delivering shocks through leads connected to the heart if it detects dangerously uneven or slow rhythms. The shocks provide an energy boost to help the heart resume beating regularly and potentially save the person's life.