Golden Hour Calculator
Find golden hour and blue hour photography windows based on your location and date.
About this tool
Golden hour is the brief window after sunrise and before sunset when the sun sits low and bathes everything in soft, warm light, while blue hour is the deeper twilight before sunrise and after sunset that fills the sky with even, cool blue tones. Both are prized by photographers because they produce flattering, atmospheric images that harsh midday light simply cannot match. This calculator uses astronomical formulas to pinpoint exactly when those windows open and close for any date and place.
To use it, enter your date and your location, and the tool shows the start and end times of golden hour and blue hour around both sunrise and sunset. It is built for photographers, videographers, and travelers who want to plan a shoot down to the minute and arrive while the light is still perfect.
Keep in mind that these times shift noticeably with the season and your latitude, so always check the figures for your exact date rather than relying on a rough estimate. Everything is computed locally in your browser, so no location data ever leaves your device.
Frequently Asked Questions
Code Implementation
import math
from datetime import datetime, timedelta, timezone
def sun_times(lat: float, lon: float, date: datetime) -> dict:
"""Calculate sunrise, sunset and golden hour times."""
# Day of year
N = date.timetuple().tm_yday
# Mean longitude and anomaly
L = (280.460 + 0.9856474 * N) % 360
g = math.radians((357.528 + 0.9856003 * N) % 360)
# Ecliptic longitude
lam = math.radians(L + 1.915 * math.sin(g) + 0.020 * math.sin(2 * g))
# Declination
decl = math.asin(math.sin(math.radians(23.439)) * math.sin(lam))
# Hour angle for sunrise/sunset (sun altitude = -0.833°)
cos_ha = (math.sin(math.radians(-0.833)) - math.sin(math.radians(lat)) * math.sin(decl)) / (math.cos(math.radians(lat)) * math.cos(decl))
if abs(cos_ha) > 1:
return {"error": "Midnight sun or polar night"}
ha = math.degrees(math.acos(cos_ha))
# Equation of time correction (simplified)
B = math.radians(360 / 365 * (N - 81))
eot = 9.87 * math.sin(2 * B) - 7.53 * math.cos(B) - 1.5 * math.sin(B)
# Solar noon in minutes from midnight UTC
solar_noon = 720 - 4 * lon - eot
sunrise_min = solar_noon - 4 * ha
sunset_min = solar_noon + 4 * ha
# Golden hour bounds: sun at 6° above horizon
cos_gh = (math.sin(math.radians(6)) - math.sin(math.radians(lat)) * math.sin(decl)) / (math.cos(math.radians(lat)) * math.cos(decl))
gh_ha = math.degrees(math.acos(max(-1, min(1, cos_gh))))
golden_end_morn = solar_noon - 4 * gh_ha
golden_start_eve = solar_noon + 4 * gh_ha
def mins_to_str(m):
h, mn = divmod(int(m), 60)
return f"{h:02d}:{mn:02d}"
return {
"sunrise": mins_to_str(sunrise_min),
"golden_hour_morning_end": mins_to_str(golden_end_morn),
"solar_noon": mins_to_str(solar_noon),
"golden_hour_evening_start": mins_to_str(golden_start_eve),
"sunset": mins_to_str(sunset_min),
}
# New York City
result = sun_times(40.7128, -74.0060, datetime(2024, 6, 21))
for k, v in result.items():
print(f"{k}: {v}")Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.