Daylight Hours Calculator

Stephanie Ben-Joseph headshot Stephanie Ben-Joseph

What this daylight hours calculator does

This calculator estimates the number of daylight hours (photoperiod) between sunrise and sunset for any latitude and day of the year. It uses standard solar geometry to approximate how long the Sun stays above the ideal horizon, assuming a clear, unobstructed view of the sky.

You can use the results to compare seasons, understand how daylight changes with latitude, or get a first-pass estimate for planning gardening, outdoor work, or solar energy production. For precise legal sunrise/sunset times at a specific address, you should still rely on an astronomical or weather service.

How the daylight calculation works

The calculation is based on the tilt of Earth’s axis (about 23.45°) and Earth’s position in its orbit. Two angles are central to the model:

A commonly used approximation for solar declination in degrees, as a function of day-of-year n (1–366), is:

δ = 23.45 ° × sin 360 365 · n 80

This captures the yearly swing of the Sun’s apparent path: δ is positive when the Sun is north of the Equator (Northern Hemisphere summer) and negative when it is south (Northern Hemisphere winter).

Once δ is known, we find the sunrise hour angle hs, which represents the angular distance the Earth rotates between solar noon and sunrise (or sunset). In an idealized model:

coshs=tanφtanδ.

The hour angle hs is measured in degrees. If we convert this rotation to time, we obtain the photoperiod N, the total hours of daylight:

N=215×arccos(-tanϕ×tanδ)

The factor 215 appears because:

Near the poles, the expression tanφtanδ can fall outside the range [-1,1]. In that case, the model predicts either continuous day (24 hours of sun above the horizon) or continuous night (0 hours of sun). The calculator detects these conditions and reports 24 h or 0 h accordingly.

Interpreting the results

The output is the idealized number of daylight hours for your chosen latitude and day-of-year. Some ways to interpret the value:

Remember that this is a geometric model at sea level with a flat horizon. Real-world sunrise and sunset can differ by several minutes because of refraction, terrain, and atmospheric conditions.

Worked example: mid-latitude city in summer

Suppose you want to estimate the daylight hours in Berlin, Germany (about 52.5° N) on the June solstice (around day-of-year n=172).

  1. Set the inputs.
    • Latitude φ=52.5° (positive for the Northern Hemisphere).
    • Day-of-year n=172.
  2. Estimate solar declination.
    Around the June solstice, δ is close to +23.45°. Using the formula above gives a value within a fraction of a degree of this.
  3. Compute the cosine of the sunrise hour angle.
    Convert φ and δ to radians internally, then evaluate tanφtanδ. For 52.5° and 23.45°, this product is between −1 and 1, so there is a normal sunrise and sunset rather than polar day or night.
  4. Find the hour angle and convert to time.
    Taking hs=arccos(-tanφtanδ) and applying N=2hs15°, we obtain roughly 16.5 hours of daylight.

A typical astronomy table for Berlin confirms that late June daylight is about 16.5–16.8 hours, showing that this simple model provides a good first approximation.

Typical daylight by latitude and season

The table below compares idealized daylight lengths at the June and December solstices for different latitudes. Values are rounded and may differ slightly from the calculator output because of rounding and model choices.

Latitude June solstice daylight (h) December solstice daylight (h) Seasonal context
0° (Equator) ≈ 12.1 ≈ 12.1 Nearly equal day and night all year
30° N ≈ 14.4 ≈ 9.8 Subtropical locations with noticeable seasons
50° N ≈ 16.4 ≈ 7.9 High-latitude regions with long summer days and short winter days
66.5° N (Arctic Circle) 24.0 0.0 Experiencing midnight sun in summer and polar night in winter
35° S ≈ 9.7 ≈ 14.5 Southern mid-latitudes with seasons opposite to the Northern Hemisphere

Use the calculator to reproduce or refine these values for specific days close to the solstices, or to explore intermediate dates such as the equinoxes (around days 80 and 264).

Practical uses and planning examples

Because daylight hours change predictably through the year, this calculator can support a range of planning tasks:

For more detailed solar-angle analysis, you can pair this calculator with a solar declination or solar altitude tool to examine how high the Sun gets in the sky for the same dates and locations.

Assumptions and limitations

The model behind this calculator uses several simplifying assumptions. These make it fast and easy to use but also explain why it may not match official sunrise/sunset times exactly.

Because of these assumptions, use the results for educational, comparative, or preliminary planning purposes rather than for safety-critical navigation or legal timekeeping.

Related tools for deeper solar analysis

If you want to go further, consider pairing this daylight hours result with other calculators:

FAQs about daylight length and accuracy

Why are days longer in summer and shorter in winter?

Because Earth’s axis is tilted about 23.45°, your hemisphere leans toward the Sun in its summer and away from the Sun in its winter. When you lean toward the Sun, its apparent path crosses the sky higher and for a longer time, producing longer days. When you lean away, the path is lower and shorter, producing short winter days.

How does latitude affect daylength?

Near the Equator, daylength stays close to 12 hours all year. As you move toward the poles, the seasonal swing increases: summers bring very long days, and winters bring very short days. Above the Arctic and Antarctic Circles, you can experience 24-hour daylight in summer and 24-hour darkness in winter.

Why doesn’t this match my weather app exactly?

Weather and astronomical services include effects such as atmospheric refraction, the finite size of the Sun, local elevation, and detailed Earth-orbit models. This calculator uses a simpler geometric approach that is usually within a few minutes of those values but not identical.

Can I use this for solar energy planning?

Yes, as a starting point. The calculator tells you how daylight duration changes with season and latitude, which is important for estimating seasonal solar production. For system design, you should combine this with local irradiance data, panel specifications, shading analysis, and, if possible, long-term measurements from your site.

Sunlight inputs

Enter geographic latitude in degrees (positive for the Northern Hemisphere, negative for the Southern Hemisphere) and the day of the year to compute photoperiod using standard solar geometry.

Provide latitude and day-of-year to calculate daylength.

Embed this calculator

Copy and paste the HTML below to add the Daylight Hours Calculator - Solar Geometry to your website.