HomeTime & Geography › Sunrise and Sunset Calculator

Sunrise and Sunset Calculator

Computes sunrise, sunset, solar noon, day length and civil twilight for any date, latitude and longitude with the NOAA Solar Calculator algorithm (Meeus-based solar position, equation of time, zenith 90.833° for refraction and the solar disc), reported in an IANA time zone.

When to use

You need sunrise/sunset or daylight hours for a place and date, e.g. for photography, outdoor planning, solar energy or prayer-time style scheduling.

Do not use when: You need minute-exact times for legal purposes, times at elevations far above sea level or with obstructed horizons, or moonrise/moonset (not covered); use moon-phase for the lunar phase.

Formula

cos(HA) = cos(90.833°) / (cos φ · cos δ) − tan φ · tan δ; sunrise_UTC = 720 − 4 · (longitude + HA) − EoT minutes; sunset_UTC = 720 − 4 · (longitude − HA) − EoT; solar_noon_UTC = 720 − 4 · longitude − EoT; civil twilight uses zenith 96°

Implements NOAA's spreadsheet/JavaScript algorithm: solar declination δ and equation of time EoT from the Julian century (Meeus), one refinement pass at the estimated event time, refraction and solar radius folded into the 90.833° zenith. Accuracy is about ±1 minute for latitudes up to ±72° (±10 minutes nearer the poles); results are the events that fall on the given calendar date in time_zone.

Inputs

ParameterTypeUnitRequiredDescription
datedatedefault todayCalendar date in time_zone (YYYY-MM-DD); defaults to the current UTC date.
latitudenumber°yesLatitude in decimal degrees (north positive, south negative). Range: ≥ -90, ≤ 90
longitudenumber°yesLongitude in decimal degrees (east positive, west negative). Range: ≥ -180, ≤ 180
time_zonestringdefault UTCIANA time zone for the reported times, normally the zone of the location (e.g. Australia/Adelaide). Defaults to UTC.

Outputs

OutputTypeUnitDescription
sunrisestringLocal time (HH:MM) the upper limb of the Sun appears; absent during polar day/night.
sunsetstringLocal time (HH:MM) the upper limb disappears; absent during polar day/night.
solar_noonstringLocal time the Sun crosses the meridian (highest point).
day_lengthstringTime between sunrise and sunset as hours and minutes.
day_length_hoursnumberhDay length in decimal hours (0 in polar night, 24 in polar day).
civil_twilight_beginstringLocal time the Sun's centre is 6° below the horizon before sunrise (zenith 96°).
civil_twilight_endstringLocal time the Sun's centre reaches 6° below the horizon after sunset.
sunrise_utcstringSunrise instant in UTC (ISO 8601).
sunset_utcstringSunset instant in UTC (ISO 8601).
solar_declination_degreesnumber°Declination of the Sun at solar noon.
equation_of_time_minutesnumberminApparent solar time minus mean solar time at solar noon.
utc_offsetstringOffset of time_zone on that date (±HH:MM).
sun_statusstring'Sun rises and sets', 'Polar day: Sun above the horizon all day' or 'Polar night: Sun below the horizon all day'.

Example

Adelaide (−34.9285, 138.6007) on 2026-09-23: {"date":"2026-09-23","latitude":-34.9285,"longitude":138.6007,"time_zone":"Australia/Adelaide"}{"sunrise":"06:04","sunset":"18:12","solar_noon":"12:08","civil_twilight_begin":"05:39","civil_twilight_end":"18:38","sunrise_utc":"2026-09-22T20:34:00Z","utc_offset":"+09:30","sun_status":"Sun rises and sets"}

London (51.5074, −0.1278) on the June solstice 2026: {"date":"2026-06-21","latitude":51.5074,"longitude":-0.1278,"time_zone":"Europe/London"}{"sunrise":"04:43","sunset":"21:22","solar_noon":"13:02","day_length":"16 h 38 min","day_length_hours":16.63,"civil_twilight_begin":"03:55","civil_twilight_end":"22:09","solar_declination_degrees":23.44}

GET https://tttkmbb.com/api/v1/calculate/sunrise-sunset?date=2026-09-23&latitude=-34.9285&longitude=138.6007&time_zone=Australia%2FAdelaide

Machine access

Sources

FAQ

Why do published times sometimes differ by a minute?

Almanacs round differently and use slightly different refraction models; NOAA's method is accurate to about one minute at mid-latitudes. Local terrain, elevation and atmospheric conditions can shift the observed event by several minutes.

What happens inside the polar circles?

When the Sun stays above (polar day) or below (polar night) the horizon all day, sunrise and sunset are omitted, sun_status explains why and day_length_hours is 24 or 0. Civil twilight is still reported when it occurs.

Related calculators