There are several ways to think of sunrise and sunset. They can be the points at which the Sun is bisected by the horizon (half in view, half not), or the points when the Sun has dropped below the horizon, or the points when the Sun is just out of view.
You might think those last two would be the same, but they’re not. Earth’s atmosphere acts as a lens, bending the Sun’s rays, so when you see the Sun standing just atop the horizon, it’s actually below the horizon, but the atmosphere has projected an image of the Sun into view.
The official timekeeper for the United States, the U.S. Naval Observatory, defines sunrise and sunset as the moments when the center of the Sun is physically 50 minutes of arc below the horizon, which is a bit less than one degree. That accounts for the size of the Sun itself, and the “bending” properties of the atmosphere. The Naval Observatory’s web site provides a tool for calculating sunrise and sunset times at any point on Earth’s surface.
The atmosphere can bend the Sun’s rays at different angles at different times, though. So the predicted times of sunrise and sunset can be off by a minute or so. And when the Sun rises and sets at a low angle to the horizon, they can be off by several minutes.