Home › Time & 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
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
date | date | default today | Calendar date in time_zone (YYYY-MM-DD); defaults to the current UTC date. | |
latitude | number | ° | yes | Latitude in decimal degrees (north positive, south negative). Range: ≥ -90, ≤ 90 |
longitude | number | ° | yes | Longitude in decimal degrees (east positive, west negative). Range: ≥ -180, ≤ 180 |
time_zone | string | default UTC | IANA time zone for the reported times, normally the zone of the location (e.g. Australia/Adelaide). Defaults to UTC. |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
sunrise | string | Local time (HH:MM) the upper limb of the Sun appears; absent during polar day/night. | |
sunset | string | Local time (HH:MM) the upper limb disappears; absent during polar day/night. | |
solar_noon | string | Local time the Sun crosses the meridian (highest point). | |
day_length | string | Time between sunrise and sunset as hours and minutes. | |
day_length_hours | number | h | Day length in decimal hours (0 in polar night, 24 in polar day). |
civil_twilight_begin | string | Local time the Sun's centre is 6° below the horizon before sunrise (zenith 96°). | |
civil_twilight_end | string | Local time the Sun's centre reaches 6° below the horizon after sunset. | |
sunrise_utc | string | Sunrise instant in UTC (ISO 8601). | |
sunset_utc | string | Sunset instant in UTC (ISO 8601). | |
solar_declination_degrees | number | ° | Declination of the Sun at solar noon. |
equation_of_time_minutes | number | min | Apparent solar time minus mean solar time at solar noon. |
utc_offset | string | Offset of time_zone on that date (±HH:MM). | |
sun_status | string | '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
- API:
GET https://tttkmbb.com/api/v1/calculate/sunrise-sunset(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/sunrise-sunset · Markdown: https://tttkmbb.com/time/sunrise-sunset.md · JSON definition: https://tttkmbb.com/time/sunrise-sunset.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="sunrise-sunset" - OpenAPI operationId:
calculate_sunrise_sunset - Freshness:
daily. Authentication: none. Rate limit: fair use (see rate limits).
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
- Moon Phase Calculator — Lunar phase and illumination for the same date.
- Time Zone Converter — Express the sunrise time in another zone.
- Julian Date Calculator — Julian Date used internally by the solar position formulas.