Sunrise and sunset depend on just three things: where you are on Earth, what day it is, and how your clock relates to the Sun. This calculator turns latitude, longitude, date and timezone into precise solar event times, then layers on golden hour, blue hour and the three twilight phases that photographers, planners and stargazers care about.
How the calculation works
The engine starts by finding the Sun's declination for your date — the latitude where the Sun is directly overhead at noon. It then solves the hour-angle equation, which relates your latitude, the declination and a target Sun altitude to the time before and after solar noon when the Sun crosses that altitude. Using -0.833° as the altitude (the standard value that accounts for atmospheric refraction bending light and the Sun's own angular radius) gives the visible sunrise and sunset.
Finally, solar time is shifted into your local clock using longitude and your UTC offset. Because the Earth turns 15° per hour, a location's longitude within its timezone determines how far solar noon strays from 12:00. The model used here is the widely taught simplified algorithm; it is accurate to a few minutes and does not include the equation of time, so results can differ slightly from official almanac tables.
Golden hour, blue hour and twilight
The same hour-angle equation, evaluated at different Sun altitudes, produces every lighting phase. Golden hour is the window when the Sun sits below about 6° of altitude — warm, soft light ideal for portraits and landscapes. Blue hour follows, with the Sun between roughly 4° and 8° below the horizon, casting an even blue glow that suits cityscapes.
Twilight comes in three formal stages defined by how far the Sun has sunk below the horizon. Civil twilight (0° to 6° below) keeps the sky bright enough to work outside. Nautical twilight (6° to 12° below) is when the horizon is still faintly visible at sea. Astronomical twilight (12° to 18° below) is the last trace of scattered sunlight before truly dark sky — important for observing faint stars and galaxies.
Why your numbers may differ from an almanac
Several real-world effects sit outside this simplified model. The equation of time — caused by the Earth's elliptical orbit and axial tilt — can shift solar noon by up to about 16 minutes across the year. Local elevation raises your effective horizon and pushes sunrise earlier and sunset later. Hills, buildings and the actual atmospheric pressure and temperature on a given day all nudge the visible event by a minute or two.
For everyday planning — knowing when to head out for golden-hour photos, how much daylight a hike has, or when streetlights will come on — the few-minute precision here is more than enough. For navigation, surveying or astronomical observation that demands second-level accuracy, cross-check against an official ephemeris such as the U.S. Naval Observatory data service.
Reading the seasons and the poles
The Year Calendar tab plots sunrise and sunset for the 15th of every month, making the seasonal swing obvious: the gap between the two lines is widest near the summer solstice and narrowest near the winter solstice. The higher your latitude, the more dramatic the swing.
Beyond the Arctic and Antarctic Circles the swing becomes absolute. Around the summer solstice the Sun never sets (the midnight sun) and around the winter solstice it never rises (polar night). The calculator detects these cases — when the hour-angle equation has no valid solution — and reports 24 or 0 hours of daylight instead of a sunrise and sunset time.