CodeKitHub
English
Everyday Tools

Sunrise and Sunset Calculator — Times for Any Date and Place

Pick a date and a city — or enter latitude and longitude yourself — and get the sunrise time, sunset time, solar noon and total day length. The calculation uses the NOAA solar position algorithm entirely in your browser: no weather API, no location tracking. The built-in list covers 50+ major world cities with their time zones, so daylight saving time is handled automatically. High latitudes are handled correctly too: during polar day or polar night the tool says so instead of showing meaningless times.

What Is This Tool?

Sunrise and sunset times follow from pure geometry: the Earth's rotation, its tilted axis and your position on the globe. Because the tilt is constant and the orbit is known, the sun's position in the sky can be computed for any date and any coordinates with an astronomical formula — no measurement or weather data needed. This tool implements the NOAA (US National Oceanic and Atmospheric Administration) solar position algorithm, the same math behind most sunrise tables.

By convention, sunrise and sunset are the moments the upper edge of the solar disk crosses the horizon, including the effect of atmospheric refraction — the bending of light that lets us see the sun when it is geometrically about 0.83° below the horizon. Solar noon is the moment the sun is highest in the sky, which is almost never exactly 12:00 clock time, since clock time zones span wide bands of longitude and add daylight saving shifts.

Why Use It?

  • 50+ major world cities built in, with correct time zones and automatic daylight saving handling.
  • Manual mode: enter any latitude, longitude and UTC offset for places not on the list.
  • Shows sunrise, sunset, solar noon and day length in one view.
  • Handles polar day and polar night at high latitudes with a clear message instead of broken values.
  • No API and no location permission — the NOAA algorithm runs entirely in your browser.

How to Use

  1. Pick a date — today is preselected.
  2. Choose a city from the list, or tick the manual option and enter latitude, longitude and UTC offset.
  3. Press the calculate button.
  4. Read the sunrise, solar noon, sunset and day length results, shown in the local time of the chosen place.

Example

Input

June 21, Istanbul (41.01° N, 28.98° E)

Output

Sunrise 05:35, sunset 20:28, day length about 14 h 53 min

June 21 is the summer solstice — the longest day of the year in the northern hemisphere. The same date in Sydney gives the shortest day of the year.

How day length changes over the year

  • At the equator, day length barely changes — about 12 hours all year round.
  • At 40° latitude (Madrid, New York, Beijing), days run from about 9 h in winter to 15 h in summer.
  • At 60° latitude (Saint Petersburg, Oslo), the range widens to roughly 6 h — 18.5 h, with long twilight around midsummer.
  • Above the polar circle, midsummer brings polar day (24 h of sun) and midwinter polar night.
  • The fastest change happens around the equinoxes in March and September — at mid latitudes each day is 2–3 minutes longer or shorter than the previous one.

Related date and time tools

Counting down to the summer solstice or any other date? The Days Until Calculator gives the exact number of days. The Date Calculator adds and subtracts days and splits intervals into years, months and days.

If daylight affects your sleep, the Sleep Calculator finds the best bedtimes based on 90-minute sleep cycles.

Days Until Calculator · Date Calculator · Sleep Calculator · Timestamp Converter

Frequently Asked Questions

Why do the times differ a few minutes from my weather app?

Small differences are normal and come from three sources. First, definitions: all serious sources include atmospheric refraction, but the assumed refraction varies with air temperature and pressure, which no formula knows in advance. Second, altitude: from a mountain or a high building the horizon is lower, so the sun rises earlier and sets later than at sea level — about one minute per 1.5 km of elevation. Third, your exact position: a city spans kilometers, and each kilometer east–west shifts the times by a few seconds. Differences of 1–3 minutes between sources are entirely expected.

What is solar noon and why isn't it at 12:00?

Solar noon is the moment the sun crosses your meridian — its highest point of the day. Clock noon rarely matches it because a time zone covers a wide band of longitudes that all share one clock, daylight saving time shifts clocks a full hour, and the equation of time (Earth's elliptical orbit and axial tilt) adds a seasonal wobble of up to ±16 minutes. In summer with DST, solar noon typically falls between 12:30 and 13:30 local time.

How does the calculator handle polar day and polar night?

Above the polar circles (66.6° latitude) the sun stays up for weeks in summer and stays down in winter. Mathematically, the sunrise equation then has no solution — there is no horizon crossing that day. Instead of showing errors or impossible times, the tool detects this case and displays a clear message: polar day (sun never sets, day length 24 h) or polar night (sun never rises).

Does the calculator account for daylight saving time?

Yes, for the built-in cities. Each city carries its IANA time zone name (like Europe/Paris), and your browser's time zone database converts the computed UTC moment into correct local time, including any DST rule active on the chosen date. In manual coordinate mode you supply the UTC offset yourself, so you need to pick the offset that applies on that date.

How accurate is the NOAA algorithm?

For years between roughly 1800 and 2100, the NOAA solar equations are accurate to well under a minute for the sun's position, and sunrise/sunset times are typically correct within one minute at moderate latitudes. Near the poles, accuracy degrades — around the polar circles the sun crosses the horizon at a very shallow angle, so a tiny angular error translates into several minutes of time. For civil purposes the results are more than accurate enough.

Is my location or data stored anywhere?

No. The tool never asks for your device location. The date, city or coordinates you enter are processed by JavaScript in your browser and are never sent to a server, stored or logged.

Related Tools