# Sunrise Sunset Calculator

Created by Rahul Dhari
Reviewed by Steven Wooding and Adena Benn
Based on research by
Duffie J A, Beckman W A Introduction. In Solar Engineering of Thermal Processes Fundamentals (2013)See 1 more source
Kalogirou S Solar Energy Engineering: Processes and Systems Environmental Characteristics (2014)
Last updated: Jun 05, 2023

The sunrise sunset calculator will assist you in determining the sunrise and sunset times for a particular day for all populated latitudes. The Earth rotates at an angular velocity of 15°/hour; therefore, there is a need for a formula to calculate sunrise and sunset based on the location. The sunrise and sunset times use location and day of the year. Based on these timings, the calculator also estimates how many hours of daylight a place would receive.

Read on to understand what time is sunrise and sunset today or if you want to know how to calculate the sunrise and sunset times based on the formula.

💡 The longer the day, the more energy you can collect with your solar panels. Check our solar panel calculator to estimate the exact values.

## Sunrise and Sunset times

The term sunrise time refers to the time when the sun first appears or when daylight has arrived. Similarly, we define sunset time as the moment when the sun disappears below the horizon. For a given location having latitude $\phi$ and nth day of the year, we can estimate the sunrise time using the hour angle for sunrise/sunset, $\omega$.

$\footnotesize\omega \!=\!\arccos\left(\frac{\cos(z)\!-\!\sin(\delta)\!\cdot\!\sin(\phi)}{\cos(\delta)\!\cdot\!\cos(\phi)}\right)$

where:

• $\delta$ — The declination angle;
• $\phi$ — The latitude of the desired location; and
• $z$ — The angle of the Sun below the horizon, equal to $90\degree$ for the exact time of the desired phenomenon.

We take this angle as it is for the sunset while we subtract it from $360\degree$ to find the sunrise. The declination angle is the angle between the equator and the line joining centers of the Earth and the Sun. The angle of declination varies with each day, $n$ such that:

$\footnotesize\delta = \arcsin(0.39872\!\cdot\!\sin(L))$

where $L$ is the true latitude of the Sun (its projected position on the Earth). Note that there are multiple ways to calculate the Sun's declination.

In our case, we calculated it from $L$, with $L$ being given by:

$\footnotesize\begin{split} L &= M+1.916\sin(M)\\ &\quad+0.02\sin(2\!\cdot\!M)+282.634 \end{split}$

$M$ is a measure of the Sun's mean anomaly, a quantity that expresses the discrepancy between the true elliptic orbit of Earth and the ideal circular orbit with an identical period for a given moment of the year:

$\footnotesize M = 0.9856\cdot t - 3.289$

The value of $t$ depends on the day number (the number of days elapsed since the first of January) and the time of the day:

$\footnotesize t = \begin{cases} n + \frac{6-\lambda_{\mathrm{hour}}}{24}\ \mathrm{(sunrise)}\\[1em] n + \frac{18-\lambda_{\mathrm{hour}}}{24}\ \mathrm{(sunset)} \end{cases}$

The second part of both equations is an approximation of the local sunrise and sunset times. In the formula, $\lambda_{\mathrm{hour}}$ is nothing but an expression of the latitude in hours. To find it, divide the value of the latitude in degrees by $15$.

Once we have the hour **angle for sunrise, $\omega$, we can calculate the local time of the sunrise and sunset by applying the following formula:

$\footnotesize T = \frac{\omega}{15} + \mathrm{RA}- (0.06571 \cdot t) - 6.622,$

where $\mathrm{RA}$ is the Sun's right ascension, that we found with:

$\footnotesize \begin{split} &\mathrm{RA} = \frac{1}{15}\!\cdot\!\Big(\arctan(0.91764 \cdot \tan(L))\\ &+( L\!\!\!\!\mod 90\degree)\\ &-(\arctan(0.91764 \cdot \tan(L))\!\!\!\!\mod 90\degree)\Big) \end{split}$

Back to business: we need to adjust the times we calculated, taking into account the local latitude and the time zone. To do so, we subtract the former and add the latter:

$\footnotesize T_\mathrm{local} = T-\lambda_\mathrm{h}+\mathrm{tz}$

Remember to consider daylight savings if the desired location observes such time. Simply add $1$ hour to the calculated time in the summer if this is the case!

To calculate the daylight hours, we compute the difference between the time of the sunset and the time of the sunrise:

$\small t_\mathrm{daylight} = T_\mathrm{local,\ sunset} - T_\mathrm{local,\ sunrise}$

While the above methodology is correct, it does not consider atmospheric refraction. This effect occurs due to the sunlight refracting through the atmosphere and making the sun appear higher above the horizon than its actual position. A small angle is included in the sunrise and sunset formula to take this phenomenon into account. Therefore, the corrected sunset and sunrise equation is:

$\footnotesize\omega \!=\!\arccos\left(\frac{\cos(90+a)\!-\!\sin(\delta)\!\cdot\!\sin(\phi)}{\cos(\delta)\!\cdot\!\cos(\phi)}\right)$

where $a$ is the altitude angle having the value of 0.83°.

🙋 You can read more about refraction in our index of refraction calculator.

## How to calculate the times of sunrise and sunset for tomorrow?

To calculate sunrise and sunset times:

1. Enter the date for tomorrow.
2. Fill in the latitude for your location (use positive for °N and negative for °S).
3. The calculator will return the declination angle for the date and subsequently calculate the sunrise and sunset times for that particular day.
4. The tool will also return how many hours of daylight you will receive.

By default, the calculator shows you results, taking into account atmospheric refraction. To see the uncorrected results, activate the Advanced mode of the calculator.

## Example: Using the sunrise sunset calculator

When are sunrise and sunset today, given the date is 15th March? Also, find out how many hours of daylight we will have on this date. Take location as $45\degree\ \mathrm{N}$, $15\degree\ \mathrm{W}$.

To know what time is sunrise and sunset today:

1. Pick the date for today as 15th March.
2. Enter the latitude as $45\degree$ and select the northern hemisphere.
3. Enter the longitude as $15\degree$ and select the western hemisphere.
4. The approximate times of sunrise and sunset are:
$\footnotesize \enspace \enspace t = \begin{cases} 75 + \frac{6-1}{24}=75.2917\ \mathrm{(sunrise)}\\[1em] 75 + \frac{18-1}{24}=75.7917\ \mathrm{(sunset)} \end{cases}$
1. Calculate the mean anomaly in both cases:
$\footnotesize \begin{split} \enspace \enspace M_{\mathrm{rise}}&= (0.9856 \cdot 75.2083) - 3.289\\ &=69.9329\\ M_{\mathrm{set}} &=(0.9856 \cdot t) - 3.289\\ &=70.4257 \end{split}$
1. Find the Sun's true latitude. We spare you the calculations:
$\footnotesize \begin{split} \enspace \enspace L_{\mathrm{rise}}&= 354.3794\degree\\ L_{\mathrm{set}} &=354.8776\degree \end{split}$
1. Now, we compute the Sun's right ascension. Again, the mathematics is rather complex. Here is the result:
$\footnotesize \begin{split} \enspace \enspace \mathrm{RA}_{\mathrm{rise}}&= 23.6560\degree\\ \mathrm{RA}_{\mathrm{set}} &=23.6865\degree \end{split}$
1. It's time to calculate the Sun's declination.
$\footnotesize \begin{split} \enspace \enspace \delta_{\mathrm{rise}}&=\arcsin\left(0.39782\sin(L_\mathrm{rise})\right)\\ &=-2.2335\degree\\ \delta_{\mathrm{set}}&=\arcsin\left(0.39782\sin(L_\mathrm{set})\right)\\ &=-2.0359\degree \end{split}$
1. Now, we can compute the hour angle. Use the formula corrected for refraction.
$\footnotesize\enspace \enspace \omega \!=\! \arccos\left(\frac{\cos(90.833)\!-\!\sin(\delta)\!\cdot\!\sin(\phi)}{\cos(\delta)\!\cdot\!\cos(\phi)}\right)$

The result is:

$\begin{split} \omega_{\mathrm{rise}} &=293.5714 \degree\\ \omega_{\mathrm{set}} &=89.1423 \degree\\ \end{split}$

Use the following formula to calculate the sunrise and sunset times:

$\footnotesize T = \frac{\omega}{15} + \mathrm{RA}- (0.06571 \cdot t) - 6.622 -\lambda_\mathrm{h}$

We can ignore both daylight savings and timezone: they both are equal to 0. The results are:

$\begin{split} t_{\mathrm{rise}} &=7.223\ \mathrm{h} =7\ \mathrm{h}\ 13\ \mathrm{min} \\ t_{\mathrm{set}} &=19.093\ \mathrm{h}=19\ \mathrm{h}\ 5\ \mathrm{min} \end{split}$

Subtract these values to find the number of daylight hours:

$\begin{split} t_\mathrm{daylight}& = t_{\mathrm{set}}-t_\mathrm{rise}\\ &=19.093-7.223 = 11.87\ \mathrm{h} \\ &=11\ \mathrm{h}\ 52\ \mathrm{min} \end{split}$

🔎 You can also quickly estimate the day duration with Omni's hours calculator.

## FAQ

### What is atmospheric refraction?

The phenomenon that celestial objects appear higher above the horizon than they actually are is known as atmospheric refraction. This occurs because of the refraction of light reflected from the objects by the atmosphere.

### What is the angular velocity of earth?

The angular velocity of Earth is 15° per hour. To calculate this result, consider these easy steps:

1. A rotation of Earth is exactly one day long, approximately 24 h.
2. A full rotation of Earth corresponds to 360°.
3. Dividing the angle above by the time of a full rotation gives us the result:
360°/24 h = 15° per h.

This is also the apparent speed of the Sun and stars in the sky. Since the Sun has a diameter of half a degree, we can calculate the length of the sunrise: 0.5/15° per h = 0.033 h ~ 2 min/

### How do I calculate sunrise hour angle?

To calculate the sunrise hour angle:

1. Find the latitude and day of the year, n.
2. Estimate the declination angle of the Sun using the equation:
δ = 23.45 × sin((284 + n) × 360/365).
Note that this equation can err up to 1.5°.
3. Multiply the tangents of latitude and declination angle.
4. Find the cosecant inverse for the negative of the product.
5. Multiply the resultant with -1 to get the hour angle for sunrise.

### How do I calculate daylight hours?

To calculate daylight hours for today:

1. Calculate the time of sunset: you can do this knowing your latitude, longitude, and day of the year.
2. Calculate the time of sunrise.
3. Subtract the two quantities. The result is the number of daylight hours in a day.

For latitudes above the polar circles, the previous method fails for at least one day a year: there, you can experience 24 hours of sunlight or darkness at specific times of the year!

Rahul Dhari
Day
Hemisphere (N/S)
N
Latitude (φ)
°
'
"
Hemisphere (E/W)
W
Longitude (λ)
°
'
"
Time zone
UTC+0 (GMT, WET)
Daylight savings?
No
w/ Atmospheric refraction
🌅 Sunrise time
hrs
min
🌄 Sunset time
hrs
min
☀ Day length
hrs
min
People also viewed…

### Internal resistance

Calculate the internal resistance of a battery using the internal resistance calculator.

### Korean age

If you're wondering what would your age be from a Korean perspective, use this Korean age calculator to find out.