🌅 Sunrise & Sunset Calculator
Calculate sunrise, sunset, solar noon, golden hour, and blue hour for any city worldwide. Pure client-side astronomy — no sign-up required.
📋 When to Use the Sunrise & Sunset Calculator
Use the Sunrise & Sunset Calculator to plan outdoor photography sessions (golden hour), evening walks, travel itineraries, solar panel timing analysis, religious observance times, or simply satisfy your curiosity about when the sun rises and sets anywhere on Earth. The calculator uses the same astronomical formulas (Julian date, solar declination, equation of time) as professional ephemeris software — all running locally in your browser.
⚙️ How the Sunrise & Sunset Calculator Works
This calculator computes solar position using well-established astronomical algorithms. First, it converts the selected date to a Julian Day Number. Then it calculates the solar mean anomaly, ecliptic longitude, solar declination, and equation of time — the same math astronomers have used for centuries. The hour angle is solved for multiple zenith distances: 90.833° (official sunrise/sunset accounting for atmospheric refraction), 96° (civil twilight — golden hour boundaries), and 102° (nautical twilight — blue hour boundaries). All calculations run in pure JavaScript with zero dependencies. No data is sent to any server. Times are displayed in your browser's local timezone.
How to Use the Sunrise & Sunset Calculator
- Select a city or use your location — Search from 400+ worldwide cities in our built-in database, or click "My Location" to use your browser's geolocation API for instant coordinates.
- Pick a date (optional) — Choose any date using the date picker. Defaults to today. The math works for any past or future date.
- Click Calculate — See 8 result cards: sunrise, sunset, solar noon, daylight duration, golden hour start/end (AM & PM), and blue hour start/end (AM & PM).
- Copy or embed — Copy the results to your clipboard, or embed the full calculator on your own website using the free iframe snippet.
Frequently Asked Questions
What is golden hour?
Golden hour is the period shortly after sunrise and before sunset when daylight is redder and softer — ideal for photography. In this calculator, golden hour AM spans from civil dawn (sun at -6° altitude) to sunrise, and golden hour PM spans from sunset to civil dusk (sun at -6° altitude). During these times, the sun is near the horizon, producing warm, diffused light with long shadows.
What is blue hour?
Blue hour is the twilight period when the sun is between -6° and -12° below the horizon, producing a deep blue hue in the sky. In this calculator, blue hour AM spans from nautical dawn (sun at -12°) to civil dawn (sun at -6°), and blue hour PM spans from civil dusk to nautical dusk. It's the perfect time for cityscape and landscape photography.
How accurate are these sunrise/sunset times?
Very accurate for most practical purposes. The algorithm accounts for atmospheric refraction (sun appears 0.833° above its geometric position) and uses mean solar declination. Accuracy is typically within 1–2 minutes. Extreme latitudes and mountainous terrain may cause slight variations.
Does it work offline?
Yes! All calculation logic runs in pure JavaScript. Once the city database is loaded from /data/cities.json (on first visit), the calculator works without internet. The astronomy math requires no external APIs.
Why do times vary by location?
Sunrise and sunset times depend on your latitude (how far north/south you are) and longitude (east/west position within your timezone). Cities farther from the equator experience larger seasonal variations. The calculator accounts for all these factors using your selected city's exact coordinates.
What is solar noon?
Solar noon is the moment when the sun reaches its highest point in the sky for a given location and date. It's not necessarily 12:00 PM on your clock — the difference (equation of time) can be up to ±16 minutes depending on the date. Photographers use solar noon to plan midday shoots with minimal shadows.