Skip the theory — calculate sunrise and sunset times for any location instantly.

Sunrise & Sunset Calculator — Free Online Tool

The three ingredients

To calculate when the Sun rises or sets at a given location and date, you need three things:

  1. Solar declination — how far north or south of the equator the Sun is on that date.
  2. Equation of time — the difference between solar time and clock time.
  3. 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:

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:

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:

TypeSun elevationWhat you can see
Civil twilight0° 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 darknessbelow −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:

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:

Calculate sunrise, sunset, golden hour and twilights for any location and date.

Open the Sunrise & Sunset Calculator

Related tools

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.