Twilight Duration Calculator
Twilight is the lit interval after sunset or before sunrise while the Sun sits below the horizon. Its length depends on your latitude and the Sun's declination, and on how deep the Sun must sink to mark the end of twilight: 6 degrees for civil, 12 for nautical, 18 for astronomical. This calculator uses the standard hour-angle geometry to find the time the Sun takes to descend from the horizon to that depression angle. Enter your latitude, the solar declination for the date, and the depression angle, all user-editable, to estimate the twilight duration in minutes.
Twilight duration formula
cos(H) = (sin(alt) - sin(lat) * sin(dec)) / (cos(lat) * cos(dec))
H_sunset uses alt = -0.833 degrees (horizon with refraction)
H_twilight uses alt = -depression angle
duration = (H_twilight - H_sunset) / 15 hours
15 degrees of rotation equals 1 hour
Each hour angle is the Sun's rotation past local noon when it reaches that altitude. The difference, divided by 15 degrees per hour, is the twilight duration. If the cosine falls outside the range minus one to one, the Sun never reaches that altitude and twilight does not end.
Twilight notes
- Civil twilight ends at 6 degrees, nautical at 12, astronomical at 18.
- The default declination 0 represents an equinox.
- Twilight lengthens toward higher latitudes and around the solstices.
- At high latitudes in summer twilight can last all night (no solution).
- For precise local clock times use NOAA's solar calculator.
Twilight duration: frequently asked questions
What is twilight duration?
Twilight is the period after sunset (or before sunrise) when the sky is partly lit because the Sun is below the horizon but still illuminating the upper atmosphere. Its duration is the time the Sun takes to sink from the horizon to a chosen depression angle. This calculator estimates that interval from your latitude and the solar declination.
What are civil, nautical, and astronomical twilight?
They are defined by how far the Sun's center is below the horizon: civil twilight ends at 6 degrees below, nautical at 12 degrees, and astronomical at 18 degrees. The depression angle is a user-editable input, so enter 6, 12, or 18 for the twilight type you want.
How is the duration computed?
It uses the hour-angle of the Sun for a given altitude: the cosine of the hour angle equals sine of altitude minus sine of latitude times sine of declination, divided by cosine of latitude times cosine of declination. The duration is the time between the horizon crossing and the depression-angle crossing, converted from degrees of Earth rotation at 15 degrees per hour.
Why can twilight last all night at high latitudes?
Near the summer solstice at high latitudes the Sun never sinks far enough below the horizon, so twilight does not end. When the geometry has no solution, the calculator reports that twilight does not end on that day, which is the physically correct outcome.
How accurate is this estimate?
It uses standard spherical-astronomy geometry and ignores atmospheric refraction beyond the chosen angles and the Sun's slow declination change during the night. It is accurate to a few minutes for most dates and latitudes. For precise local times use NOAA's solar calculator or the U.S. Naval Observatory.
Official sources
- U.S. Naval Observatory: rise, set, and twilight definitions.
- NOAA Global Monitoring Laboratory: solar position calculator.
Reviewed by the CalculatorHub team, edited by James Graham, 17 June 2026. See our methodology.