Sunrise & Sunset Calculator
Work out sunrise, sunset and day length for any date and place, from latitude and longitude, using the standard solar algorithm.
Formula: the standard NOAA solar position algorithm — solar declination and the hour angle from latitude, date and longitude. Times are approximate, within a few minutes; they do not account for hills, buildings or local weather.
How to use the sunrise & sunset calculator
- Pick a date and your timezone offset from UTC.
- Enter the latitude and longitude of the place.
- Press “Calculate Sunrise & Sunset” to see sunrise, sunset and day length.
Sunrise & sunset calculation example
In Lahore (about 31.5° N, 74.3° E), the shortest day around 21 December has roughly 10 hours 10 minutes of daylight, and the longest around 21 June about 14 hours 10 minutes.
Tips for using the sunrise & sunset calculator
- Use decimal degrees for coordinates: Karachi is about 24.86, 67.01.
- The result uses the standard definition of sunrise (the top of the Sun on the horizon, allowing for refraction); hills and buildings change what you see.
- Prayer times use different sun angles; use your local mosque or a prayer-times source for Fajr and Isha.
Sunrise & sunset calculator: common questions
- How do I find my latitude and longitude?
- Search your city name followed by “latitude longitude”, or long-press your location on a map app to read the coordinates.
- Why are the times approximate?
- The solar algorithm assumes a flat horizon. Hills, tall buildings and local weather shift the visible sunrise and sunset by a few minutes.
- What if the sun never sets or never rises?
- Near the poles in summer or winter the sun can stay up or down all day — the page says so instead of giving a time.
- Is my data stored?
- No. The calculation runs in your browser.
- Why isn't the earliest sunset on the shortest day?
- Because of Earth's tilted, elliptical orbit, solar noon shifts during the year, so the earliest sunset comes a couple of weeks before the solstice.