Skip the theory — calculate sunrise and sunset times for any location instantly.
Sunrise & Sunset Calculator — Free Online ToolThe three ingredients
To calculate when the Sun rises or sets at a given location and date, you need three things:
- Solar declination — how far north or south of the equator the Sun is on that date.
- Equation of time — the difference between solar time and clock time.
- Hour angle — how far the Sun must travel (in time) to reach the horizon from solar noon.
Solar declination
Earth's axis is tilted 23.5° relative to its orbital plane. As Earth orbits the Sun over the course of a year, the tilt causes the Sun to appear at different heights in the sky. In late June the Sun is 23.5° north of the equator (summer solstice in the northern hemisphere); in late December it is 23.5° south (winter solstice).
The declination on any given date can be calculated from a Julian century value derived from the Julian Day Number. For our purposes:
declination = arcsin(sin(obliquity) × sin(apparent_sun_longitude))
Where obliquity is approximately 23.44° (the axial tilt, slowly decreasing over time) and apparent sun longitude accounts for Earth's elliptical orbit and other perturbations.
Equation of time
If Earth orbited the Sun in a perfect circle and had no axial tilt, the Sun would cross the meridian at exactly the same time every day. But two factors cause solar noon to drift up to 16 minutes from clock noon:
- Orbital eccentricity — Earth moves faster when closer to the Sun (perihelion in early January) and slower when farther away (aphelion in early July). This causes the Sun to appear to speed up and slow down in the sky.
- Axial tilt — The projection of the Sun's motion onto the equatorial plane is uneven because of the 23.5° tilt.
These two effects are added together to give the Equation of Time (EqT), measured in minutes. Combined with your longitude, it gives the exact time of solar noon:
solar_noon_UTC (minutes) = 720 − 4 × longitude − EqT
Hour angle and sunrise/sunset
The hour angle is the angular distance the Sun must travel from solar noon to reach the horizon. The key formula is:
cos(HA) = (sin(elevation) − sin(lat) × sin(decl)) / (cos(lat) × cos(decl))
For sunrise and sunset, the target elevation is −0.833° (not 0°) because:
- Standard atmospheric refraction bends sunlight by about 0.567° near the horizon.
- The Sun's disc has a radius of about 0.266°, so sunrise is defined when the upper edge — not the centre — touches the horizon.
Once we have the hour angle HA (in degrees), sunrise and sunset in UTC minutes are:
sunrise_UTC = solar_noon_UTC − 4 × HA
sunset_UTC = solar_noon_UTC + 4 × HA
Twilight types
Twilight is the period when the sky is illuminated even though the Sun is below the horizon, because sunlight still reaches the upper atmosphere. Different types are defined by how far below the horizon the Sun is:
| Type | Sun elevation | What you can see |
|---|---|---|
| Civil twilight | 0° to −6° | Enough light for most outdoor activities. Legal definition of dusk/dawn in many countries. |
| Nautical twilight | −6° to −12° | Horizon visible at sea; celestial navigation with a sextant is possible. |
| Astronomical twilight | −12° to −18° | Sky not fully dark; faint deep-sky objects are affected by residual light. |
| True darkness | below −18° | Sky is fully dark. All astronomical observations unaffected by solar illumination. |
Each twilight type uses the same hour angle formula — only the target elevation changes (−6°, −12° or −18°).
Golden hour and blue hour
These are photography terms based on the quality of natural light:
- Golden hour — The Sun is between 0° and 6° above the horizon. Light travels through more atmosphere, scattering blues and leaving warm reds and oranges. Shadows are long and soft. Duration varies from ~20 minutes near the equator to over an hour at high latitudes.
- Blue hour — The Sun is between 0° and 6° below the horizon (during civil twilight). The sky glows deep blue as scattered blue light fills the sky evenly. There are no hard shadows and exposures are balanced between sky and artificial lights.
Polar day and polar night
At latitudes above the Arctic/Antarctic circles (approximately ±66.5°), the Sun can stay above or below the horizon for entire days. In the formula, this appears as |cos(HA)| > 1, meaning no solution exists — the Sun never crosses the target elevation. Our calculator detects this and displays "Polar day" or "Polar night" accordingly.
Accuracy
The NOAA algorithm used in our calculator is accurate to within one minute for locations between 72°N and 72°S. Actual sunrise/sunset times can differ slightly from predictions because:
- Local terrain may block or reveal the horizon earlier or later than flat ground.
- Actual atmospheric refraction varies with temperature and pressure (the standard value of 0.567° is an average at sea level).
- The calculation assumes the observer is at sea level.
Calculate sunrise, sunset, golden hour and twilights for any location and date.
Open the Sunrise & Sunset CalculatorRelated tools
- GPS Coordinate Converter — Convert between decimal degrees, DMS, UTM and Geohash.
- GPS Distance Calculator — Distance and bearing between two coordinates.
- Time Zone Converter — Convert times between any two time zones.
Frequently asked questions
Why does sunrise time vary throughout the year?
Because Earth's axis is tilted 23.5° relative to its orbital plane. As Earth orbits the Sun, the tilt causes the Sun to appear higher or lower in the sky each season. In summer the Sun rises earlier and sets later; in winter the opposite occurs. The variation is more extreme at higher latitudes.
What causes the equation of time?
Two factors: Earth's elliptical orbit (which makes Earth orbit faster when closer to the Sun) and the tilt of the axial. These two effects combine to produce a variation of up to 16 minutes throughout the year. The extremes occur around early November (+16 min) and mid-February (−14 min).
How long is golden hour?
It depends on your latitude and the season. Near the equator golden hour lasts around 20–30 minutes. At mid-latitudes (40–50°N/S) it typically lasts 45–60 minutes. Near the poles in summer, the Sun moves at such a shallow angle that golden hour can last several hours.