Sunrise Sunset Calculator
Find out when the sun rises and sets at any location on any day of the year. Enter your latitude, longitude, and the day of the year, and this calculator uses solar position equations to compute sunrise, sunset, solar noon, and total daylight hours. New York City on the summer solstice (day 172) gets about 15 hours of daylight, while Fairbanks, Alaska gets over 21 hours.
How it works:
The calculator uses the Spencer (1971) equations for solar declination and the equation of time to determine the sun's position relative to any point on Earth.
Key formulas:
- Solar declination: The angle between the sun and the equatorial plane, ranging from +23.45° (summer solstice) to -23.45° (winter solstice)
- Hour angle: cos(HA) = -tan(lat) x tan(declination). This determines how many degrees the Earth rotates between sunrise and solar noon.
- Solar noon: 12:00 - 4 x longitude - equation of time (adjusted for time zone)
Day of year reference:
- January 1 = Day 1
- March 20 (spring equinox) = Day 79
- June 21 (summer solstice) = Day 172
- September 22 (fall equinox) = Day 265
- December 21 (winter solstice) = Day 355
Polar regions:
At latitudes above the Arctic Circle (66.5°N) or below the Antarctic Circle (66.5°S), the sun can stay above or below the horizon for entire days. The calculator detects midnight sun and polar night conditions and reports them instead of times.
Accuracy note:
These times are within about 1-2 minutes of official NOAA values. Differences come from atmospheric refraction (which makes the sun visible slightly before geometric sunrise) and the fact that official sunrise/sunset times use the upper limb of the sun's disk, not its center.