Time & Date

Sunrise Sunset Times

Sunrise and sunset by location. Free online Sunrise Sunset Times. Calculate sunrise sunset times online — fast, accurate, mobile-friendly, no signup needed.

Approximate times using latitude

Sunrise (hours)
4.577739
Sunset (hours)
19.422261

Derivation

  1. ├── 01Givenlat = 40, doy = 172
  2. ├── 02FormulaSunrise (hours): 12-180 × acos(-tan(t × π / 180) × tan(n × π / 180)) / π / 15
  3. ├── 03Compute Sunrise (hours)4.577739
  4. ├── 04FormulaSunset (hours): 12+180 × acos(-tan(t × π / 180) × tan(n × π / 180)) / π / 15
  5. └── 05Compute Sunset (hours)19.422261
Did you know?

Every calculator here runs 100% in your browser — nothing is sent to a server or stored in a database.

§01What is

Understanding the Sunrise Sunset Times

The Sunrise Sunset Times computes Sunrise (hours) from 2 inputs: latitude, day of year (1-365). Sunrise and sunset by location.

Time calculations span everything from calculating how much a freelancer bills for a multi-timezone project to estimating how old someone will be on a specific future date. The math is simple but the edge cases (leap years, DST, month lengths) trip people up. The Sunrise Sunset Times sits in that toolkit — it sunrise and sunset by location. Enter your numbers above and the result updates instantly; every step of the math is shown in the Derivation panel so you can see exactly how the answer was reached.

§02The Formula

How it’s calculated

Sunrise (hours) = 12-180 × acos(-tan(t × π / 180) × tan(n × π / 180)) / π / 15 | Sunset (hours) = 12+180 × acos(-tan(t × π / 180) × tan(n × π / 180)) / π / 15

Where

lat
Latitude
doy
Day of year (1-365)
Sunrise (hours)
Output value
Sunset (hours)
Output value
§03Practical Example

Step-by-step walkthrough

Scenario

Apply the formula to a realistic set of inputs: Latitude = 40, Day of year (1-365) = 172.

  1. 01Start by noting the input — Latitude: 40.
  2. 02Start by noting the input — Day of year (1-365): 172.
  3. 03Substitute these values into the formula: Sunrise (hours) = 12-180 × acos(-tan(t × π / 180) × tan(n × π / 180)) / π / 15 | Sunset (hours) = 12+180 × acos(-tan(t × π / 180) × ta…
  4. 04Compute Sunrise (hours): the calculator returns 4.57774.
  5. 05Compute Sunset (hours): the calculator returns 19.4223.
  6. 06Cross-check the answer by opening the Derivation panel above — every line of math is shown so you can follow the computation end-to-end.
§04Variants

Common Sunrise Sunset Times Problems

The formula gets rearranged depending on which variable you need. Here are the patterns you’ll run into in the real world — find the one that matches your problem and follow the worked steps.

01 · PATTERN

Latitude halved

lat = 20 (from 40)

Keep every other input at its default and halve the latitude. See how sunrise (hours) responds.

  1. 01New Latitude: 20
  2. 02Baseline Sunrise (hours): 4.57774
  3. 03New Sunrise (hours): 5.3947
  4. 04Sunrise (hours) increases by 17.8% → use this sensitivity to plan for real-world variation.
02 · PATTERN

Day of year (1-365) halved

doy = 86 (from 172)

Keep every other input at its default and halve the day of year (1-365). See how sunrise (hours) responds.

  1. 01New Day of year (1-365): 86
  2. 02Baseline Sunrise (hours): 4.57774
  3. 03New Sunrise (hours): 5.88722
  4. 04Sunrise (hours) increases by 28.6% → use this sensitivity to plan for real-world variation.
03 · PATTERN

Day of year (1-365) doubled

doy = 344 (from 172)

Keep every other input at its default and double the day of year (1-365). See how sunrise (hours) responds.

  1. 01New Day of year (1-365): 344
  2. 02Baseline Sunrise (hours): 4.57774
  3. 03New Sunrise (hours): 7.39385
  4. 04Sunrise (hours) increases by 61.5% → use this sensitivity to plan for real-world variation.
§05FAQ

Frequently asked questions

Yes. The calculator implements the standard formula as documented and returns exact floating-point results. No approximations are used unless noted in the formula.
Your feedback

How useful was this calculator?

Your ratings stay in your browser — they help us learn which tools people actually rely on.

Rate it
Was this helpful?