Our sunset calculator will surprise you with the simple math behind the calculations for the sunset time. Discover the numbers behind the most romantic moment of the day with Omni Calculator.
You will learn, among other things:
- What's sunset and the various types of the sunset?
- How to calculate the sunset time if there was no atmosphere.
- The refraction correction.
And much more!
What is sunset?
Sunset is the moment of the day when the Sun dips below the horizon in the evening. The sunset, or sundown marks the beginning of the night: the last lights of the day inspired generations of artists in their creations and fascinate people literally around the world every day. Everyone stared in admiration at a mesmerizing sunset with thousand shades of red, pinks, and oranges at least once.
The fact that the sunset is accompanied by a plethora of other events, from the elusive green flash to the Earth's shadow in the atmosphere, contributed to the attractiveness of this phenomenon. However, from an astronomical point of view, it's not special at all!
Sunset is the most desired moment of the day for astronomers, who can finally whip out their instruments to start their nightly exploration of the skies. Or can they?
While sunset is the moment of the day when the Sun is crossing the horizon (we say it is above it), it doesn't mark the beginning of the darkness. The light merely dims! In fact, the sunset, as we commonly intend it, marks the beginning of the twilight, which terminates when the Sun reaches below the horizon. At this time, you may start spotting some particularly bright stars (Vega, Betelgeuse, or Canopus) and some planets (even though Venus may appear even in the daylight!). Usually, you can walk around without needing artificial lighting.
When you finally need to turn on a flashlight to see around you, you enter the nautical twilight. This sunset phase lasts until the Sun reaches below the horizon, and astronomers define it as the phase in which you can still discern the horizon. After the nautical twilight, all stars that you can see with the naked eye are there for your amazement.
Still, you must wait until the astronomical twilight, when the Sun finally crosses below the horizon, to see the faint nebulas and clusters that decorate the night sky. Let's Sun... sum them up!
- Sunset – (on the horizon);
- Civil twilight – and below the horizon;
- Nautical twilight – and below the horizon;
- Astronomical twilight – and below the horizon; and
- Night – Below .
In the following sections, we will teach you how to use the formula to calculate the sunset time: you will be surprised by how little data are required and how simple are the equations we need!
How do I calculate sunset?
Let's first understand the nature of our problem. When we calculate the sunset hours, we are looking for the hours at which the Sun makes contact, and crosses, the horizon. We need to introduce some quantities related to these calculations, but first, let's analyze the problem!
The Earth orbits around the Sun on a plane we project on the sky as the ecliptic. The ecliptic and Earth's equator lie at an angle of , and remain in a fixed position relative to each other.
This tilt relative to Earth's orbital plan allows one hemisphere to receive more sunlight during half of the year and lie in relative darkness during the other half, depending on the direction in which Earth's axis points. During winter, for the northern hemisphere, the north side of the axis points outside the orbit. The effect is that in the winter, the height reached by the Sun in the northern hemisphere is lower than in the summer. You can understand this concept better by using pictures!
Remember that the angle remains unchanged: from our Earthly perspective, we see the Sun changing position as illustrated in the figure above for a generic location in the northern hemisphere.
What changes during the year is the Sun declination, the angle between solar rays — which reach Earth as parallel lines — and the equatorial plan. This angle varies from to , reaching the maximum values in the solstices. During the equinoxes (in spring and autumn), the declination is , and Earth's equator coincides with the ecliptic.
Calculating the declination is the first step to finding the sunset hour. To do so, we choose a point on Earth, defined by the coordinates and , respectively latitude and longitude.
🙋 We will make the following calculations easier by performing them in degrees. If you need to calculate in radians, you may change some of the coefficients or convert the angles, maybe with our angle conversion tool!
After fixing the space, we need to set the time: choose the day for which you want to calculate the sunset. We can't input a date in the algorithm, so we will calculate the day number, starting from for the first of January. Call this number .
🙋 We can make our calculations even more accurate by factoring in the hours. But the eventual change in the final result would be negligible, apart from being a bit counterintuitive: why does the sunset hour change with the hour?
Our first formula to calculate the sunset allows us to find the approximate time of the phenomenon in days, starting from the first of January at midnight:
After all, six in the afternoon is not a bad moment for the sun to set. In the formula, is a measure of the longitude in hours: we find it with the simple formula:
Next step: considering the characteristic of Earth's orbit. We will calculate the Sun's mean anomaly, which measures the deviation of an elliptic orbit from a circular one.
We measure this quantity in degrees. It corresponds to how much the Earth overshot the trajectory on the imaginary circular orbit with the same orbital period as the actual elliptic one.
The following two passages will use this quantity to find a reasonable estimate of the Sun's coordinates in the sky: did you know that stars and planets have coordinates as any place on Earth? Obviously, their position depends on the point of view: such a system is strictly geocentric, but it works wonders! This is why we calculate the Sun's true latitude and right ascension (the analog to the longitude).
For the true latitude, we use the following formula:
And for the right ascensions this one:
🔎 Since we calculate these coordinates in degrees, their values must fall in the range . If necessary, use the modulo operation as we taught you in the modulo calculator, and compute and .
Both these quantities must fall in the same quadrant of the sky: while the true latitude is easy to fix (we use the equator as a reference), the right ascension, as the latitude, needs an arbitrary reference. To fix this uncertainty, calculate these two values:
And update the value of the right ascension according to the following:
Now convert this last result in hours by dividing it by as we did for the latitude:
We have all the ingredients to find the time of sunset. Let's calculate the Sun declination first:
This quantity is enough to calculate the local hour angle. The hour angle, in general, is the moment of the day in which the Sun reaches a specific position: we marked it with the variable degrees, and it corresponds to the degrees after the vertical over your head, the zenith.
For the sunset, you have a bit of choice when it comes to :
- For the sunset (when the Sun's center crosses the horizon), set ;
- For the civil twilight set ;
- For the nautical twilight set ; and
- For the astronomical twilight set .
Once done, we can calculate the local mean time of the sunset in UTC:
Now we need to correct this result according to three factors:
- Longitude of the desired place;
- Local time zone; and
- Eventual use of daylight savings (if applicable).
- — Longitude expressed in hours;
- — Local time zone; and
- — Correction due to daylight saving time: if the desired location is currently using that time, assign value to , otherwise, leave it at .
🙋 The result of the last equation is in hours. However, it may be beyond the correct boundaries: if your result is negative or larger than , use the operation .
How to calculate the sunset time considering atmospheric refraction
If you use our sunset calculator, you will notice that the results under the section uncorrected are incorrect. We meant "uncorrected" in a scientific way, as in "without correction". 😛
Anyway, the reason for the discrepancy between the real sunset time and the one we calculated with the formulas above is atmospheric refraction. Earth's atmosphere changes with height, as you can observe by climbing a tall mountain: the higher you go, the lower the pressure and, simultaneously, the density. This change in density is responsible for a continuous variation of the atmosphere's refraction index: as a consequence, the Sun's light rays bend: you can clearly picture this phenomenon:
This effect peaks in intensity at sunrise and sunset, where the total deviation amounts to . It may not sound like a lot, but it gives you six minutes of sunlight more for each side!
🙋 This phenomenon reaches extremes in the polar regions: the Novaya Zemlya effect may cause the Sun to rise weeks before the forecasted date!
How do we model the atmospheric refraction in our formulas to calculate the sunset time? We change the zenith angle to . This way, we include both the effect of refraction and the Sun's diameter (defining sunset as the time the last portion of the Sun's disk disappears below the horizon). The new hour angle is, as a result of this, defined as:
This is the most accurate modeling we can offer you when calculating the sunset time. Notice that we didn't include the effect of refraction in the other types of dusk: the higher the angle, the lower the effect, and for such "weakly" defined phenomena, the difference would be, at most, arbitrary.
Other Sun-related tools
Why stop at sunset? The formulas you met in our sunset calculator work for the sunrise, too: visit Omni's sunrise and sunset calculator or the more specific tools:
- The sunrise calculator; and
- The daylight calculator.
How do I calculate the sunset time?
There's no simple equation to calculate the sunset. Here are, indicatively, the steps to find the sunset time:
Calculate the position of the Sun on the projection of Earth (true latitude and longitude).
Calculate the position of the Sun in the sky (declination and right ascension).
Find the hour angle of the desired phenomenon.
Calculate the sunset time in UTC, knowing the angular speed of the Sun.
Convert UTC to local time with the addition of longitude, timezone, and, eventually, daylight savings adjustments.
What are the possible types of sunset?
We can identify four types of sunsets, variations of the same phenomenon:
- The proper sunset (or dusk);
- The civilian dusk, when the Sun crosses the line 6 degrees below the horizon;
- The nautical dusk, when the Sun reaches 12 degrees below the horizon; and
- The astronomical dusk that marks the beginning of the last influences of sunlight in the night sky.
How do I consider refraction in the calculations for the sunset time?
Refraction causes the Sun's rays to bend when crossing the various layers of the atmosphere. We can easily calculate the effects of atmospheric refraction in our formulas for the sunset by changing the definition of "when" the Sun sets, adding 0.833 degrees to the angle we use to define the moment of the sunset.
How do I calculate the sunset from the hour angle?
To calculate the sunset from the hour angle, follow these easy steps:
Calculate the hour angle for the desired phenomenon. In our case, the sunset, or when the angle from the zenith is
Use the hour angle to calculate the UTC time of the local sunset.
Adjust the result of the calculations to account for the local language, timezone, and the eventual presence of daylight savings.