Guide · updated 2026-09-30

How sunrise and sunset times are calculated

Short answer

Sunrise and sunset are the moments when the sun's center is 0.833° below the horizon, which puts its upper edge on the horizon after allowing for average refraction. The time depends on latitude, longitude and date. At Denver's capitol on June 21, 2026 that gives 14 h 59 min of daylight.

What counts as sunrise

The sun is a disk about half a degree wide, and the atmosphere bends its light so it appears higher than it is near the horizon. A sunrise defined by the center of the sun on a geometric horizon would come a few minutes late compared with what you see. The calculation used on this site, from the SunCalc library, counts sunrise when the sun's center is 0.833° below the horizon: roughly its radius plus a standard allowance for refraction.

That definition is why the equator gets slightly more than 12 hours of daylight even on the equinox. At 0° on March 20, 2026 the calculation gives 12 h 07 min.

The steps of the calculation

  1. Count the days since a fixed reference date and compute the sun's position along its yearly path, including the small correction for Earth's elliptical orbit.
  2. From that, get the sun's declination, the latitude where it is overhead at noon. It swings between about 23.4° north in June and 23.4° south in December.
  3. Find solar noon for the longitude: the moment the sun crosses the local meridian. This shifts by 4 minutes per degree of longitude.
  4. Solve for the hour angle at which the sun's altitude equals -0.833°. The hour angle before and after solar noon gives sunrise and sunset.
  5. Convert those moments from universal time to local clock time with the place's time zone rules, including daylight saving time.

Worked example: Denver on June 21

Denver's capitol sits at 39.739° N, 104.985° W. On June 21, 2026 the sun reaches its highest point at 1:01 PM local time, at an altitude of 4,222.9°. Sunrise comes at 5:32 AM and sunset at 8:31 PM, for 14 h 59 min of daylight. The Denver sunrise and sunset page has the same numbers for every month.

June vs December daylight at every capital

Sorted by the difference between the longest and shortest day. Juneau, AK swings the most, from 18 h 17 min in June to 6 h 22 min in December. Honolulu, HI swings the least, by 2 h 36 min.

CapitalJune 21December 21Difference
Juneau, AK18 h 17 min6 h 22 min11 h 54 min
Olympia, WA15 h 54 min8 h 30 min7 h 24 min
Bismarck, ND15 h 52 min8 h 32 min7 h 20 min
Helena, MT15 h 50 min8 h 34 min7 h 16 min
Saint Paul, MN15 h 37 min8 h 46 min6 h 50 min
Salem, OR15 h 37 min8 h 46 min6 h 50 min
Pierre, SD15 h 32 min8 h 51 min6 h 42 min
Augusta, ME15 h 32 min8 h 51 min6 h 41 min
Montpelier, VT15 h 31 min8 h 51 min6 h 40 min
Boise, ID15 h 26 min8 h 56 min6 h 30 min
Concord, NH15 h 23 min8 h 59 min6 h 25 min
Madison, WI15 h 22 min9 h 00 min6 h 23 min
Lansing, MI15 h 20 min9 h 02 min6 h 18 min
Albany, NY15 h 19 min9 h 03 min6 h 17 min
Boston, MA15 h 17 min9 h 05 min6 h 13 min
Providence, RI15 h 13 min9 h 08 min6 h 05 min
Hartford, CT15 h 13 min9 h 08 min6 h 04 min
Des Moines, IA15 h 12 min9 h 10 min6 h 02 min
Cheyenne, WY15 h 09 min9 h 13 min5 h 56 min
Lincoln, NE15 h 06 min9 h 15 min5 h 52 min
Salt Lake City, UT15 h 06 min9 h 15 min5 h 51 min
Harrisburg, PA15 h 03 min9 h 18 min5 h 45 min
Trenton, NJ15 h 02 min9 h 18 min5 h 44 min
Columbus, OH15 h 01 min9 h 20 min5 h 41 min
Springfield, IL15 h 00 min9 h 21 min5 h 39 min
Indianapolis, IN15 h 00 min9 h 21 min5 h 38 min
Denver, CO14 h 59 min9 h 21 min5 h 38 min
Carson City, NV14 h 56 min9 h 25 min5 h 31 min
Dover, DE14 h 56 min9 h 25 min5 h 31 min
Topeka, KS14 h 55 min9 h 25 min5 h 29 min
Annapolis, MD14 h 54 min9 h 26 min5 h 29 min
Washington, DC14 h 54 min9 h 26 min5 h 28 min
Jefferson City, MO14 h 52 min9 h 28 min5 h 24 min
Sacramento, CA14 h 52 min9 h 28 min5 h 24 min
Charleston, WV14 h 50 min9 h 30 min5 h 21 min
Frankfort, KY14 h 49 min9 h 30 min5 h 19 min
Richmond, VA14 h 46 min9 h 34 min5 h 11 min
Nashville, TN14 h 37 min9 h 42 min4 h 56 min
Raleigh, NC14 h 35 min9 h 44 min4 h 51 min
Santa Fe, NM14 h 35 min9 h 44 min4 h 50 min
Oklahoma City, OK14 h 34 min9 h 45 min4 h 48 min
Little Rock, AR14 h 29 min9 h 49 min4 h 40 min
Columbia, SC14 h 25 min9 h 53 min4 h 32 min
Atlanta, GA14 h 24 min9 h 55 min4 h 29 min
Phoenix, AZ14 h 22 min9 h 56 min4 h 26 min
Montgomery, AL14 h 17 min10 h 01 min4 h 15 min
Jackson, MS14 h 16 min10 h 02 min4 h 14 min
Baton Rouge, LA14 h 07 min10 h 11 min3 h 56 min
Tallahassee, FL14 h 07 min10 h 11 min3 h 56 min
Austin, TX14 h 06 min10 h 12 min3 h 54 min
Honolulu, HI13 h 26 min10 h 50 min2 h 36 min
Computed with SunCalc for 2026 at the stored capitol coordinates.

How accurate is a calculated sunrise?

The formulas are close approximations, and the larger errors are local: hills or buildings on the horizon delay the sunrise you see, and unusual air temperatures change refraction by a minute or more. Elevation matters too, since a viewer on a mountain sees over the curve of the Earth. Treat any published sunrise as a guide to within a few minutes, and only for a flat, open horizon. The horizon distance guide explains the effect of height.

Twilight before sunrise and after sunset

The sky is light before sunrise and after sunset. Civil twilight lasts until the sun is 6° below the horizon, the point where most outdoor activity still works without lights. Nautical twilight runs to 12° and astronomical twilight to 18°. On June 21, 2026, civil dawn in Denver comes at 4:59 AM, which is 33 minutes before sunrise.

Try it

Sunrise sunset calculator

Sunrise, sunset, golden hour, and day length on the local clock of any place.

Sunrise
...
Sunset
...
Solar noon
...
Golden hour
...
Day length
...

Looking up the local time zone…

Questions people ask

What is civil twilight?

The period when the sun is between 0.833 and 6 degrees below the horizon, before sunrise and after sunset. The sky is usually bright enough for outdoor activity without lights.

Why is there more than 12 hours of daylight on the equinox?

Sunrise and sunset are counted when the sun's upper edge touches the horizon, and refraction lifts the sun's image. Both add a few minutes to each end of the day.

Does elevation change sunrise time?

Yes. A higher viewpoint sees the sun earlier in the morning and later in the evening. Standard tables assume sea level and a flat horizon.

Why is the earliest sunrise not on the longest day?

Solar noon drifts through the year because of Earth's tilted axis and elliptical orbit, so the earliest sunrise comes a few days before the June solstice and the latest sunset a few days after.

Sources and data as of

Data as of: computed with SunCalc for 2026 at the capital coordinates stored on this site.

  1. 01SunCalc library (Vladimir Agafonkin), algorithms after Jean Meeus

How every number is computed: methodology. Spotted a wrong figure? Report an error.