How Sunrise, Sunset and Golden Hour Are Calculated
Sunrise and sunset are calculated from just three inputs: your latitude, your longitude and the date. From those, standard astronomical formulas work out where the sun sits in the sky at every moment, and "sunrise" is simply the moment its top edge clears a flat horizon. If you just want the answer for your city, the free Sunrise, Sunset & Moonrise Calculator gives you sunrise, sunset, golden hour, blue hour, moonrise and moon phase for any place and date, right in your browser.
I built that tool because I kept needing these numbers — for planning a weekend photo walk, for checking how late it stays light in a city I was travelling to, and out of plain curiosity about why two websites never quite agree. This post explains what's going on underneath, in plain language.
What actually counts as "sunrise"?
Sunrise is the moment the upper edge of the sun appears above the horizon — not the centre. On top of that, Earth's atmosphere bends sunlight (refraction), so you can see the sun slightly before it is geometrically above the horizon.
Calculators handle both effects with one number: they treat sunrise and sunset as the moment the sun's centre is 0.833° below the horizon. That's roughly half the sun's apparent width plus an average allowance for refraction. NOAA's solar calculation glossary notes that its published times are corrected for the approximate effect of refraction — and that the exact effect can't be predicted, with the possible error growing closer to the poles.
How the calculation works, step by step
You don't need the equations to use a calculator, but it helps to know the shape of what's happening:
Find the sun's position in its yearly orbit. From the date, the formulas work out where Earth is around the sun, which gives the sun's declination — how far north or south of the equator it appears. This is what makes summer days long and winter days short.
Find solar noon for your longitude. Solar noon is when the sun is highest in the sky. It depends on your longitude and a small seasonal wobble called the equation of time, which is why solar noon is rarely exactly 12:00 on the clock.
Work out how far the sun must travel to reach the horizon. Using your latitude and the sun's declination, the formulas calculate the hour angle — how long before and after solar noon the sun sits at −0.833°. Subtract it from solar noon for sunrise; add it for sunset.
Repeat for other angles. Civil twilight, golden hour and blue hour use exactly the same method, just with a different target angle.
Convert to local time. The result comes out in UTC, and is then shown in the time zone of the place you picked, including daylight saving time.
My tool uses the open-source suncalc library for steps 1–4, plus one small correction of my own. Astronomical formulas run on a timescale called Terrestrial Time, which is currently about 69 seconds ahead of the UTC on our clocks — Wikipedia's ΔT article explains why. Feeding UTC straight into the formulas makes every time roughly a minute late, so the calculator adjusts for it.
The different kinds of light, explained
Here's what each time on the sunrise and sunset calculator means, measured by the sun's height above (+) or below (−) the horizon:
Time | Sun's position | What you see |
|---|---|---|
Civil dawn | −6° | Sky light enough to see outdoors without lights |
Blue hour (morning) | −6° to −4° | Deep blue sky, no direct sunlight |
Sunrise | −0.833° (centre) | Top edge of the sun appears |
Golden hour (morning) | Sunrise to +6° | Low, warm, soft light |
Solar noon | Highest point | Shortest shadows of the day |
Golden hour (evening) | +6° to sunset | Warm light returns |
Sunset | −0.833° (centre) | Top edge of the sun disappears |
Blue hour (evening) | −4° to −6° | Blue twilight after sunset |
Civil dusk | −6° | Streetlights and car headlights start to matter |
Civil twilight
Civil twilight is the most formally defined of these. According to Wikipedia's twilight article, it is when the geometric centre of the sun is between the horizon and 6° below it. After that come nautical twilight (6°–12°) and astronomical twilight (12°–18°), which matter more to sailors and stargazers than to most of us.
Golden hour
Golden hour is a photographer's term, not an official one — and the "hour" is loose. The golden hour article on Wikipedia points out that the effect has no clearly defined duration. The convention I use (and suncalc uses) is sunrise until the sun reaches 6° in the morning, and 6° down to sunset in the evening. Near the equator the sun climbs steeply, so golden hour can be short; at high latitudes in summer the sun climbs slowly and it can last much longer.
Blue hour
Blue hour is even less standardised. I use the common photography convention of the sun between 6° and 4° below the horizon.
Why sunrise times differ between websites
If you compare three sites and get three times a minute or two apart, none of them is necessarily wrong. The usual reasons are:
Different coordinates for "the city". A city can span tens of kilometres, and the east side genuinely sees the sun first. One site might use the city centre, another the airport.
Different formulas and rounding. Some round to the nearest minute, some cut off the seconds, and some use slightly different constants.
Elevation and terrain. Standing on a hill lets you see over the curve of the Earth a little, so the sun appears earlier. Mountains or tall buildings on your horizon do the opposite. Most calculators — mine included — assume a flat horizon at sea level.
Time zone handling. A tool that shows times in your time zone instead of the location's can look hours off at first glance.
That last one is why my tool always labels the time zone it's using. Pick a city and you get that city's local time; enter your own coordinates and you get your browser's time zone, clearly marked.
How to find sunrise, sunset and golden hour for any city
Here's the quickest way to do it with the free tool:
Open the Sunrise, Sunset & Moonrise Calculator.
Pick one of the built-in cities, press Use my location, or type a latitude and longitude in decimal degrees (north and east positive, south and west negative).
Choose a date — it starts on today.
Read sunrise, sunset, solar noon and day length at the top, then civil twilight, golden hour and blue hour underneath.
Check moonrise, moonset, moon phase and how much of the moon is lit.
Scroll down to the 7-day table if you're planning around the week ahead.
Everything runs in your browser. If you use your location, the browser asks for permission first, and the coordinates stay on your device — nothing is sent to a server.
What happens near the poles?
Far enough north or south, the sun can stay up all day in summer (the midnight sun) or stay below the horizon all day in winter (polar night). A naive calculator just prints "Invalid Date" here, which isn't helpful.
Mine tells you plainly: polar day or polar night, with a day length of 24 hours or zero. It also handles the in-between cases. In Tromsø, Norway around the June solstice, for example, the sun never sets but still dips low enough around midnight for a long stretch of golden light — so the tool shows golden hour running through the night rather than claiming there isn't one.
A quick word on the moon
Moonrise and moonset are harder than sunrise, because the moon moves quickly across the sky, so it rises and sets at a noticeably different time each day. Some days it doesn't rise or set at all within the calendar date. The calculator scans the moon's height through the local day and reports what actually happens — including "no moonrise this day" when that's the honest answer.
The moon phase shows a name (waxing crescent, full moon and so on) and an illumination percentage: how much of the visible disc is lit.
Related tools
If you work with dates and times a lot, a few other free tools on the site pair well with this one: the Unix Timestamp Converter for turning raw timestamps into readable dates, and the Date Difference Calculator for counting days between two dates. You'll find more write-ups like this one on the blog.
FAQ
What is golden hour?
Golden hour is the period just after sunrise and just before sunset when the sun is low and the light is soft and warm. My calculator uses the common definition of sunrise until the sun reaches 6° above the horizon, and 6° down to sunset in the evening.
What is the difference between civil twilight and sunrise?
Civil twilight starts first, when the sun's centre is 6° below the horizon and the sky is already fairly bright. Sunrise comes later, when the top edge of the sun appears above the horizon.
Why do sunrise times differ between websites?
Usually because of the exact coordinates used for a city, different rounding and formulas, and whether elevation is considered. Differences of a minute or two are normal; entering your own coordinates gives the most precise result.
How accurate is a sunrise and sunset calculator?
Close enough for planning a photo, a walk or a drive, but not to the second. Real-world refraction varies with the weather, and hills or buildings on your horizon change what you actually see, with larger uncertainty near the poles.
Why is there no sunrise or sunset for some places?
Inside the Arctic and Antarctic circles, the sun can stay above the horizon all day in summer (polar day) or below it all day in winter (polar night). A good calculator says so instead of showing an error.
Does the sunrise calculator send my location anywhere?
No. The calculations run entirely in your browser, and if you use your location, the coordinates stay on your device.
Found this useful? Share it with your network.
Comments
Leave a comment