Sunrise & Sunset Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

What this calculator estimates

Give it a spot on Earth and a calendar date, and it returns the clock times when the Sun’s upper edge grazes a flat, unobstructed horizon — the moments we call sunrise and sunset. Under the hood it runs the same low-order solar model that powers most web sun-time tools: it finds the Sun’s declination for the day, solves for the hour angle at which the Sun sits 0.833° below the true horizon, and converts that angle into local clock time. That 0.833° offset is what makes these true sunrise/sunset times rather than the instant the Sun’s center reaches the geometric horizon.

Along with sunrise and sunset it reports the length of daylight between them. Times come back in your browser’s time zone, so the numbers read naturally if you are looking up your own location — but keep that in mind if you punch in coordinates halfway around the world.

Inputs (and how to enter them)

  • Latitude (φ): degrees north/south of the equator. Valid range: −90 to +90. North is positive; south is negative.
  • Longitude (λ): degrees east/west of Greenwich. Valid range: −180 to +180. East is positive; west is negative (e.g., New York City is about −74°).
  • Date: the calendar date for which you want sun times.

How sunrise/sunset are defined

“Sunrise” and “sunset” are not computed for the Sun’s center exactly at the geometric horizon. Most almanacs define them when the Sun’s upper limb touches the horizon. To approximate this, calculations commonly use a target solar elevation of:

a = −0.833°

This value bundles typical atmospheric refraction near the horizon (~34 arcminutes) and the Sun’s apparent semi-diameter (~16 arcminutes). Real conditions can shift observed times by minutes.

Core formulas (conceptual)

At a high level, sunrise and sunset come from solving when the Sun reaches the chosen elevation angle a at your latitude on the given date. A standard approach uses the Sun’s declination (δ) and the local hour angle (H).

1) Solar declination (δ)

The declination δ is the Sun’s angular position north/south of Earth’s equatorial plane. It changes slowly day to day as Earth orbits the Sun. There are several approximations; many calculators compute δ from the day-of-year or from a Julian-date-based solar model.

2) Hour angle at sunrise/sunset (H)

For a given latitude φ, declination δ, and target elevation a, the sunrise/sunset hour angle satisfies:

cos ( H ) = sin ( a ) sin ( φ ) sin ( δ ) cos ( φ ) cos ( δ )

Once you compute H (in degrees), you can convert it to time because Earth rotates ~15° per hour. Conceptually:

  • Solar noon happens when the Sun crosses the local meridian.
  • Sunrise is approximately solar-noon minus H/15 hours.
  • Sunset is approximately solar-noon plus H/15 hours.

Practical calculators also account for the “equation of time” (the difference between mean time and apparent solar time) and longitude offset from the time zone’s standard meridian.

Interpreting results

  • Sunrise time: when the Sun first becomes visible over an ideal horizon (upper edge), using the −0.833° convention.
  • Sunset time: when the Sun’s upper edge disappears below an ideal horizon.
  • Day length: time between sunrise and sunset. This is a useful derived value for planning outdoor time.

If your results differ from an “official” local source by a few minutes, that can be normal due to differences in refraction assumptions, elevation, horizon obstructions, rounding, and the solar model used.

Trying it out: New York on the June solstice

Say you want to know how long the longest day of the year runs in New York City. Enter 40.71 for latitude, −74.01 for longitude, pick 2024-06-21, and calculate. Because June 21 sits at the northern solstice, the Sun's declination is near its yearly maximum of +23.4°, which pushes the sunrise hour angle wide and stretches daylight to its annual peak — roughly 15 hours in New York.

Run the same coordinates on the December solstice and the picture flips: the declination swings to −23.4°, the hour angle narrows, and daylight collapses to about 9 hours. Watching those two extremes side by side is the clearest way to see how a single number, declination, drives the whole seasonal rhythm. If a browser set to Eastern time shows the June sunrise near 5:25 AM and sunset near 8:30 PM, that is the calculation working as expected; a few minutes of drift from an official almanac is normal.

Method comparison

Feature This calculator Professional astronomy software Simple location lookup
Inputs Latitude, longitude, date Coordinates + elevation + pressure/temperature + more City/location name, date
Horizon model Ideal flat horizon Can model terrain/horizon/elevation Typically assumes defaults
Refraction handling Standard −0.833° convention Configurable / physical refraction models Varies; often undocumented
Output detail Sunrise/sunset (and sometimes day length) Sunrise/sunset + twilight + azimuth + solar noon Usually sunrise/sunset only
Best for Planning, quick estimates anywhere on Earth High-precision needs (aviation, research) Convenience for common places

Assumptions & limitations

  • Standard refraction + solar radius: Uses the common −0.833° sunrise/sunset definition. Real refraction varies with pressure, temperature, and humidity.
  • Sea-level / no elevation adjustment: If you are at higher elevation (mountain, tall building), you can often see the Sun earlier at sunrise and later at sunset than this estimate.
  • Flat, unobstructed horizon: Buildings, hills, and terrain can delay sunrise or hasten sunset relative to the calculation.
  • High latitudes: Near the Arctic/Antarctic circles, there are dates when the Sun does not rise or does not set. In these cases, the hour-angle equation may have no real solution (the calculator should indicate “no sunrise” / “no sunset”).
  • Time zone & DST: If results are shown in your device time zone, traveling users or coordinates outside your time zone may see misleading “local” times. Daylight Saving Time rules can also affect displayed clock time by one hour depending on date and region.
  • Model differences: Different solar algorithms (and rounding) can shift results by a few minutes compared with government almanacs or observatories.

Common questions about sun times

Does the calculator include Daylight Saving Time (DST)?

Times are converted using your browser's own time zone, so DST is folded in automatically for wherever your device thinks it is. The catch: if you type in coordinates from another region, the clock times still come back in your zone rather than the local zone of those coordinates, so treat cross-country lookups as offsets to interpret rather than literal local times.

Why are my results different from NOAA or a weather app?

Small differences (often a few minutes) can come from different refraction assumptions, rounding, elevation/horizon differences, or the time zone used to display results.

What longitude sign should I use?

Use positive values for east longitudes and negative values for west longitudes (e.g., London ~ −0.13, Tokyo ~ +139.7, New York ~ −74.0).

Can there be no sunrise or no sunset?

Yes. At very high latitudes, some dates have continuous daylight (midnight sun) or continuous night (polar night). The calculator should indicate when sunrise/sunset does not occur on that date.

Is this the same as twilight times?

No. Sunrise/sunset uses the −0.833° convention. Twilight (civil/nautical/astronomical) uses different solar elevation thresholds (e.g., −6°, −12°, −18°) and is not the same as sunrise/sunset.

Filling in the three fields

  1. Type your latitude in decimal degrees, positive for the northern hemisphere and negative for the southern (New York is 40.71, Sydney is −33.87). A map or phone GPS reading is precise enough.
  2. Type your longitude in decimal degrees, positive east of Greenwich and negative west of it (New York is −74.01, Tokyo is 139.7). Getting the sign right matters more than the last decimal place.
  3. Pick the date you care about — the seasonal swing means a July result tells you nothing about January.
  4. Calculate, then re-run a second date (try both solstices) to see how far the sunrise and daylight numbers move for your spot.
Status messages will appear here.

Arcade Mini-Game: Sunrise & Sunset Calculator Calibration Run

Use this quick arcade run to practice separating useful scenario inputs from common planning mistakes before you rely on the calculator output.

Score: 0 Timer: 30s Best: 0

Start the game, then use your pointer or arrow keys to catch useful inputs and avoid bad assumptions.

Status messages will appear here.