Sun position calculator – sun path, sunrise and sunset on a map

Click the map, search a town or use your location, and the tool shows the sun's elevation and azimuth for any date and time, with sunrise, sunset, solar noon, day length, twilight, golden hour and the shadow of an object. Lines on the map show where the sun rises and sets. Times are accurate to well under a minute against an astronomical ephemeris; the real horizon and the weather can shift them by minutes. Nothing is uploaded.

Or click anywhere on the map. Yellow: sunrise direction, red: sunset, orange: the sun now; the curve is the sun’s path across the sky.

The GeoJSON and KML files hold the point, the sunrise, sunset and sun directions and the shadow. Need a shapefile? Convert the GeoJSON to a shapefile on FileReshape.

Map and data: OpenFreeMap, MapLibre GL JS, NOAA Solar Calculator formulas (after Jean Meeus, Astronomical Algorithms), timezone-boundary-builder (via geo-tz), IANA time zone database (tz database), in your browser, GeoNames (via all-the-cities) – all data sources.

Where will the sun be over my garden at four in the afternoon, which way do the windows face to catch the evening light, and how long is the shadow of the new house in December? Questions like these need two angles: the sun's elevation above the horizon and its azimuth, the compass direction measured clockwise from north. This tool works them out for any place on Earth and any date and time. Pick a point and the map gets a yellow line towards sunrise, a red line towards sunset and an orange line towards the sun at the chosen time, with the day's sun path drawn as a curve: think of it as the sky seen from above, with the point straight overhead in the middle and the dashed circle as the horizon. A dark line shows the shadow of an object of the height you choose, drawn to scale. Drag the time slider to watch the sun move, step a day at a time, or pick any date. The panel gives sunrise and sunset with their directions, solar noon and the sun's highest elevation, the day length and how it changes from the day before, civil, nautical and astronomical twilight, and the golden and blue hours photographers plan around. Every time is given in the place's own time zone, and a whole year of sunrise and sunset times can be downloaded as CSV.

How to use it

  1. Click the map, search a town or city, paste coordinates or press "Use my location".
  2. Choose a date, then drag the time slider or press Now to see the sun's elevation, azimuth and shadow at that moment.
  3. Read sunrise, sunset, solar noon, day length, twilight and golden hour in the panel; the lines on the map show the directions.
  4. Download the whole year as CSV, the lines as GeoJSON or KML, or copy the share link.

How accurate is it?

How the position is calculated

The sun's position comes from the formulas of the NOAA Solar Calculator, which follow Jean Meeus' Astronomical Algorithms: the sun's longitude, the obliquity of the ecliptic, the declination and the equation of time for the moment you choose, turned into elevation and azimuth for your latitude and longitude. We tested them against PyEphem, an astronomical library built on the VSOP87 planetary theory. On 400 random places and moments between 2020 and 2031 the elevation and azimuth differed by at most 0.015°, about a thirtieth of the sun's width.

How sunrise and sunset are found

Sunrise and sunset are the moments the centre of the sun is 0.833° below the horizon, the convention of almanacs: 34′ for the bending of light in the atmosphere plus 16′ for half the sun's disc, so the top edge just touches a flat horizon. The tool follows the sun's elevation through the whole local day and finds every crossing to the second, so midnight sun and polar night come out without special cases. On 400 random days between 65° S and 65° N, sunrise, sunset, civil twilight and solar noon agreed with PyEphem within 32 seconds, and half of them within 1.4 seconds.

What the calculation leaves out

The formulas assume a flat, sea-level horizon and a standard atmosphere. Hills, buildings and trees hide the sun earlier than the calculated sunset, a high viewpoint sees it later, and unusual temperatures bend the light more or less: near the horizon refraction can vary by a quarter of a degree, which moves sunrise by one or two minutes at mid latitudes and by much more near the poles. The elevation shown is the apparent one, including refraction; above about 10° the difference is tiny.

Good to know

Solar noon is rarely at 12:00

The sun is highest at solar noon, which depends on your longitude within the time zone, on summer time and on the equation of time, which moves it by up to 16 minutes through the year. In Madrid solar noon is after 14:00 in summer; in Shanghai it comes as early as 11:40 in November. The earliest sunset of the year is therefore some days before the shortest day, and the latest sunrise some days after it.

Twilight and golden hour definitions differ

Civil, nautical and astronomical twilight end when the sun is 6°, 12° and 18° below the horizon. Golden hour has no official definition; the tool uses the common one for photographers, the sun between 6° above and 4° below the horizon, and blue hour between 4° and 6° below. Near the equator these last twenty minutes or so; in summer in Scandinavia they can last for hours.

Shadows on a slope

The shadow length is for a vertical object on level ground: height divided by the tangent of the sun's elevation. On a slope facing away from the sun the shadow is longer, and on a slope facing it, shorter. At a low sun the shadow gets very long, so the line on the map stops at 5 km.

Frequently asked questions

What is the sun's azimuth and elevation?

The azimuth is the compass direction of the sun, in degrees clockwise from true north: 90° is east, 180° south and 270° west. The elevation, or altitude, is the angle of the sun above the horizon: 0° at sunrise and sunset, 90° straight overhead.

Does the sun rise exactly in the east?

Only around the equinoxes in March and September. In the northern summer it rises north of east and sets north of west, and in winter it rises south of east; the further from the equator, the bigger the swing. In Copenhagen the midsummer sunrise is about 43° from north, and the midwinter sunrise about 133°.

How do I find the direction of sunset from my house?

Press "Use my location" or click your house, choose the date, and follow the red line on the map. The panel gives the sunset time and its azimuth. Step through the dates to see how the direction moves with the seasons.

How long is the shadow of a building?

Type the building's height, choose the date and time, and read the shadow length and direction in the panel. The dark line on the map shows the shadow to scale. In winter at northern latitudes a 10 m building can cast a shadow of 50 m or more at noon.

Can I get sunrise and sunset times for a whole year?

Yes. Press "The whole year as CSV" to download sunrise, sunset, their directions, solar noon, the sun's highest elevation, the day length and civil twilight for every day of the year, in the place's own time zone.

Something wrong or missing? E-mail [email protected] and it will be fixed.