Time, Date, Navigation & Astronomy Sunrise, Twilight & Sun Geometry NOAA solar position algorithm (after Meeus, Astronomical Algorithms)

Sunrise and Sunset Time Calculator

Enter a latitude, longitude, date and UTC offset and this calculator returns sunrise, sunset, solar noon, day length and the compass bearings where the Sun crosses the horizon. It uses the NOAA solar position algorithm, the same set of expressions behind the NOAA solar calculator, including the standard −0.833° horizon that accounts for the Sun's angular radius and mean atmospheric refraction. Add your elevation and the horizon dip is applied too.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
LatitudePositive north, negative south. Decimal degrees, not degrees and minutes.40.7128 °
LongitudePositive east of Greenwich, negative west. New York is about −74.-74.006 °
UTC offsetThe offset actually in force on that date, so include the daylight saving hour if the location was observing it.-4 h
Observer elevationHeight above the surrounding terrain or sea. It lowers the visible horizon and brings sunrise forward slightly.0 m
YearFour-digit year.2026
MonthMonth number, 1 for January through 12 for December.6
DayDay of the month, in local time at the location.21

It returns

  • Sunrise — Local clock time when the Sun's upper limb appears at the horizon.
  • Sunset
  • Solar noon — When the Sun crosses the local meridian, midway between sunrise and sunset.
  • Day length
  • Sunrise bearing — Compass bearing clockwise from true north; 90° is due east.
  • Sunset bearing
  • Solar declination
  • Equation of time

The formula

cosω0=sinh0sinφsinδcosφcosδ
L=2ω015
d=0.0347h

In plain text: cos ω₀ = (sin h₀ − sin φ sin δ) / (cos φ cos δ); noon = 720 − 4λ − EoT + 60·tz; sunrise = noon − 4ω₀; sunset = noon + 4ω₀

  • ω₀Sunrise hour angle — how far the Earth must turn from noon to sunset (degrees)
  • h₀Solar altitude defining the event: −0.833° at sea level, lowered further by horizon dip (degrees)
  • φObserver latitude, positive north (degrees)
  • δSolar declination on that date, between ±23.44° (degrees)
  • λObserver longitude, positive east (degrees)
  • EoTEquation of time — apparent solar time minus mean solar time (minutes)
  • tzUTC offset in force at the location on that date (hours)

The factor 4 converts degrees of hour angle to minutes of time, because the Earth turns 15° per hour and so 1° per 4 minutes. When |cos ω₀| exceeds 1 there is no solution and the Sun is either up or down for the whole day.

Updated Category Sunrise, Twilight & Sun Geometry Verified against published test cases Reading time 11 min

What sunrise actually means, and why it is not geometric

Sunrise is defined as the instant the upper limb of the Sun first appears at the visible horizon, not the instant the centre of the Sun crosses the geometric horizon. Two effects separate those, and both push sunrise earlier and sunset later.

The first is the Sun's angular size. Its disc subtends about 32 arcminutes, so its upper edge reaches the horizon while the centre is still 16 arcminutes below. The second is atmospheric refraction: light entering the atmosphere at a grazing angle bends downward, lifting the apparent position of a body at the horizon by about 34 arcminutes under standard conditions. Add the two and the centre of the Sun sits 50 arcminutes — 0.833° — below the geometric horizon at the moment of sunrise. That is the number this calculator uses, and it is the value the NOAA solar calculator uses.

Those 0.833° are not a small correction. At the equator the Sun climbs at about 15° per hour, so the pair of effects adds roughly three and a half minutes to each end of the day — about seven minutes of day length, which is why day and night are not exactly equal at the equinox. At high latitudes the Sun's path is much shallower, so the same angular allowance can move sunrise by half an hour or more.

Refraction is the weak link in any sunrise prediction. The 34-arcminute figure is a standard-atmosphere average; on a cold morning with a strong temperature inversion, real refraction can exceed a degree, and mirages of the Sun rising several minutes early are routinely observed in polar regions. Quoting sunrise to the second is therefore false precision. To the minute is honest.

The formula, one variable at a time

Everything follows from one spherical-triangle relation. For an observer at latitude φ, the Sun at declination δ reaches altitude h₀ at the hour angle ω₀ satisfying cos ω₀ = (sin h₀ − sin φ sin δ) / (cos φ cos δ). Hour angle is measured in degrees from the meridian, so ω₀ is literally how far the Earth must rotate between solar noon and sunset.

Declination is the Sun's angular distance north or south of the celestial equator, swinging between +23.44° at the June solstice and −23.44° at the December solstice. This calculator computes it from the Sun's apparent ecliptic longitude via the geometric mean longitude, the equation of centre and the corrected obliquity, which is the NOAA chain and is good to a few arcseconds — far better than the refraction uncertainty. The solar declination calculator works through that chain on its own.

Solar noon in local clock minutes is 720 − 4λ − EoT + 60·tz. The 720 is midday in minutes; −4λ corrects for how far you sit from the zone's central meridian, at four minutes per degree; −EoT corrects for the fact that a sundial and a clock disagree by up to about a quarter of an hour depending on the date; and +60·tz converts from Greenwich to your civil zone. The equation of time calculator explains that term, which arises from the eccentricity of Earth's orbit and the tilt of its axis.

Sunrise and sunset are then simply noon ∓ 4ω₀, converting hour-angle degrees to minutes of time. When |cos ω₀| exceeds 1 there is no solution: the Sun's daily circle never crosses the altitude h₀, and you have polar day or polar night. This calculator detects that and says so rather than returning nonsense.

Worked example: day length at 45°N on the June solstice

Take an observer at latitude 45°N at sea level on 21 June, when the solar declination is at its maximum of about +23.44°.

  1. Horizon altitude. At sea level h₀ = −0.833°, so sin h₀ = −0.014538.
  2. Latitude terms. sin 45° = 0.707107 and cos 45° = 0.707107.
  3. Declination terms. sin 23.44° = 0.397766 and cos 23.44° = 0.917490.
  4. Numerator. −0.014538 − (0.707107 × 0.397766) = −0.014538 − 0.281279 = −0.295817.
  5. Denominator. 0.707107 × 0.917490 = 0.648754.
  6. Hour angle. cos ω₀ = −0.295817 / 0.648754 = −0.455977, so ω₀ = arccos(−0.455977) = 117.128°.
  7. Day length. 2 × 117.128 / 15 = 15.617 hours, which is 15 h 37 m.

Repeat with δ = −23.44° for the December solstice: the numerator becomes −0.014538 + 0.281279 = +0.266741, so cos ω₀ = 0.411159, ω₀ = 65.722° and the day length is 2 × 65.722 / 15 = 8.763 hours, or 8 h 46 m. The annual swing at 45°N is therefore 15.617 − 8.763 = 6.854 hours. Note that the two day lengths sum to 24.380 hours rather than 24: the excess of 0.380 h, about 23 minutes, is the refraction-and-semidiameter allowance counted once at each solstice.

Day length at the solstices and equinox by latitude

Computed from 2ω₀/15 with h₀ = −0.833° and δ = +23.44°, 0° and −23.44°. Southern latitudes swap the June and December columns.
Latitude (N)June solsticeEquinoxDecember solsticeAnnual swing
12.12 h12.11 h12.12 h0.00 h
10°12.71 h12.11 h11.54 h1.17 h
20°13.34 h12.12 h10.92 h2.42 h
30°14.08 h12.13 h10.21 h3.87 h
40°15.01 h12.14 h9.32 h5.69 h
45°15.62 h12.16 h8.76 h6.85 h
50°16.37 h12.17 h8.07 h8.30 h
60°18.87 h12.22 h5.87 h13.00 h
66.5°24.00 h12.28 h2.24 h21.76 h
75°24.00 h12.43 h0.00 h24.00 h

Every cell is the same arccos evaluated at the three declinations, so you can reproduce any row on a scientific calculator. The equinox column creeps upward with latitude rather than staying at 12.11 h: with δ = 0 the numerator is fixed at sin(−0.833°), but the denominator still carries cos φ, so the refraction allowance buys more time the further you go from the equator.

How to read the result

Trust the times to about a minute at mid-latitudes and to several minutes above 66°, where the Sun's shallow approach magnifies every uncertainty in refraction. The algorithm itself is far more accurate than that; the atmosphere is the limiting factor, not the arithmetic.

Solar noon is rarely at 12:00, and the gap tells you two things at once. Part of it is your longitude offset from the zone's central meridian, worth four minutes per degree, and part is the equation of time, which swings from about −14 minutes in mid-February to about +16 minutes in early November. A location on the western edge of a wide time zone can see solar noon after 13:30 in summer with daylight saving applied.

The sunrise and sunset bearings are compass angles clockwise from true north, so 90° is due east and 270° due west. They are equal to 90° and 270° only at the equinoxes; in northern summer the Sun rises well north of east. Photographers and architects should note these are true bearings, not magnetic, so apply your local magnetic declination before using a hand compass.

Day length is the interval between the calculated sunrise and sunset, so it inherits the same −0.833° convention. It is not the interval of useful light: civil twilight adds a meaningful working period at each end, and at high latitudes that period can be hours long. The twilight times calculator gives those thresholds, and the daylight hours calculator compares day length across dates.

Assumptions and limits

  • Standard refraction is assumed. The 34-arcminute allowance is a mean value; temperature inversions can shift real sunrise by minutes, and by far more inside the polar circles.
  • The horizon is assumed unobstructed and level. A hill, building or mountain ridge to your east delays sunrise, sometimes by an hour, and no coordinate-based calculation can know about it.
  • The elevation correction models a sea horizon. The dip formula 0.0347√h degrees applies when you can see the true horizon; on land, terrain usually intervenes.
  • No daylight saving is applied. Enter the UTC offset actually in force on that date, including the summer hour if relevant.
  • Times are quoted to the minute. Anything finer is not physically meaningful given the refraction uncertainty.
  • Polar cases return a state, not a time. Where the Sun never reaches −0.833°, the calculator reports that it stays up or stays down rather than inventing a time.

Where the algorithm comes from

The chain used here — geometric mean longitude, mean anomaly, equation of centre, apparent longitude, corrected obliquity, declination and equation of time — is the low-precision solar position method set out in Jean Meeus's Astronomical Algorithms and implemented in the NOAA Global Monitoring Laboratory's solar calculator spreadsheets. NOAA states that its accuracy for sunrise and sunset is within about a minute for latitudes below 72°, degrading beyond that because of the shallow solar path and refraction variability. Nothing here uses a proprietary or undocumented model.

Use this calculator when you want clock times for a specific place and date. When you care about how much daylight there is rather than when it starts, the daylight hours calculator gives day length and the day-over-day change, which is what growers managing photoperiod actually need. When you need the low-light windows, the twilight times calculator handles the −6°, −12° and −18° thresholds along with the golden and blue hour.

For shadow work — solar access studies, panel siting, film scheduling — the sun shadow length calculator converts solar altitude to shadow length at any time of day, and the sundial hour line angle calculator lays out a dial for a given latitude. The equation of time calculator is the tool for reconciling a sundial reading against a clock.

Two things this page cannot do for you. It cannot account for terrain, so in a valley you should measure the real horizon altitude and treat that as your h₀. And it will not tell you the offset in force on a historical date; for that, check the zone rule and enter the correct offset yourself, using the time zone converter if you need to move the result into another zone afterwards.

Key terms

Hour angle
The angle through which the Earth must turn to bring an object to the local meridian, measured in degrees. Fifteen degrees is one hour.
Declination
The angular distance of the Sun north or south of the celestial equator, varying between ±23.44° over the year.
Equation of time
Apparent solar time minus mean solar time, ranging from about −14 to +16 minutes, caused by orbital eccentricity and axial tilt.
Horizon dip
The angle by which the visible sea horizon falls below the geometric horizontal when you are above sea level, about 0.0347√h degrees for h in metres.
Azimuth
A compass bearing measured clockwise from true north: 0° north, 90° east, 180° south, 270° west.

Frequently asked questions

Why is day and night not exactly 12 hours at the equinox?

Because sunrise is defined by the Sun's upper limb at the visible horizon rather than by its centre at the geometric horizon. The 16 arcminutes of solar radius plus about 34 arcminutes of refraction put the centre 0.833° below the horizon at sunrise, adding several minutes at each end. At the equator that gives 12.11 hours of daylight at the equinox rather than 12.00.

How accurate are these times?

Within about a minute for latitudes below 72°, which is the accuracy NOAA states for this algorithm. The limit is atmospheric refraction, not the arithmetic — real refraction varies with temperature and pressure profile, and a strong inversion can move observed sunrise by several minutes. Above the polar circles, where the Sun approaches the horizon at a shallow angle, errors grow substantially.

Why is solar noon not at 12:00?

Two reasons add together. Your longitude is generally not the central meridian of your time zone, and each degree away is worth four minutes. On top of that the equation of time shifts apparent solar time by up to about a quarter of an hour depending on the date. With daylight saving added, solar noon can fall well after 13:00 on the western edge of a wide zone.

Does this account for daylight saving time?

No — you enter the UTC offset directly, so include the daylight saving hour yourself if the location was observing it on that date. Entering −5 for New York in July rather than −4 will make every time an hour early. The reference table generated for the year uses whatever offset you supplied for all twelve rows.

What does it mean when the calculator says the Sun stays up?

It means the equation for the hour angle has no solution: the Sun's daily circle never dips to −0.833°, so there is no sunrise or sunset that day. That is polar day, and its mirror is polar night. It occurs above about 66.5° latitude near the solstices, with the exact threshold shifted slightly by the refraction allowance and by your elevation.

How much does elevation change sunrise?

The visible horizon drops by about 0.0347√h degrees, with h in metres, so at 100 m the dip is 0.347° and at 2,000 m it is 1.55°. At mid-latitudes each 0.1° of extra horizon depression is worth roughly half a minute, so a 2,000 m summit sees sunrise several minutes earlier than sea level at the same coordinates — but only if nothing blocks the true horizon.

What are the sunrise and sunset bearings for?

They tell you where on the compass to look, which matters for photography, for solar access studies and for aligning buildings or panels. They are true bearings measured clockwise from north, equal to 90° and 270° only at the equinoxes. Apply your local magnetic declination before using them with a handheld compass.

Can I use this for a location in the southern hemisphere?

Yes — enter a negative latitude. The seasons invert automatically because the sign of φ flips the sign of the sinφ sinδ term, so 45°S on the December solstice returns the same 15.617-hour day that 45°N gets in June. Remember to enter a southern-hemisphere UTC offset and to observe that summer time there runs from about October to April.

References

  • NOAA Solar Calculator — solar position and sunrise/sunset equationsNational Oceanic and Atmospheric Administration, Global Monitoring Laboratory
  • Astronomical Algorithms, 2nd edition — chapters 25 (solar coordinates) and 15 (rising, transit and setting) — Willmann-Bell
  • Explanatory Supplement to the Astronomical Almanac, 3rd edition — atmospheric refraction and the definition of rise and set — University Science Books
  • Rise, Set and Twilight DefinitionsUnited States Naval Observatory, Astronomical Applications Department