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), Terrain Tiles (Mapzen / Tilezen on AWS Open Data) – all data sources.

Key facts

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.

The month table of sunrise and sunset times

Under the panel the tool lists every day of the chosen month: sunrise, sunset, day length, solar noon with the sun's highest elevation, and the change in day length from the day before. Near the solstices the change is only seconds, but around the equinoxes it is fast and grows with latitude: about 2 min 40 s a day in New York, 4 min in London and more than 5 min in Oslo, while in Singapore it is a few seconds. Days with midnight sun or polar night say so instead of a time. Click a day to show it on the map, step to the previous or next month, or download the month as CSV.

Daylight through the year

Under the month table a chart shows the whole year at once. Each column is a day, from midnight at the bottom to midnight at the top on the local clock, coloured as daylight, civil, nautical and astronomical twilight or night, so the step where summer time starts and ends is visible too. Beside it the tool lists the longest and shortest day and the earliest and latest sunrise and sunset of the year with their dates, and far north and south it counts the days of midnight sun and polar night. In London the longest day is 16 h 38 min on 21 June and the shortest 7 h 50 min on 21 December. Where the clocks go back in November, as in New York, the latest sunrise by the clock is the last day of summer time, not a day in winter. Click a day in the chart to show it on the map.

The sun over a landmark

Under the year chart, "Sun over a landmark" finds the days when the sun rises, sets or stands behind a tower, a hilltop or the end of a street seen from your point. Pick the landmark on the map or paste its coordinates, and type its height above the ground. The tool takes the ground height at both points from Terrain Tiles, puts your eye 1.7 m above the ground and works out the direction on the WGS84 ellipsoid and the angle up to the top of the landmark, with the curve of the earth and the normal bending of light near the ground (k = 0.13). It then follows the sun minute by minute through the next 12 months and lists every day the centre of the sun comes within 1° of the top, sideways and in height – about two sun widths. The sun's path shifts only a little from one day to the next, so the days come in runs, usually two a year on either side of a solstice, and the tool marks the closest day of each run. Seen from Copenhagen towards azimuth 240°, 1° up, it finds the same 20 days in 2027 as the PyEphem ephemeris, to the minute.

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.

Can I see sunrise and sunset times for a whole month?

Yes. Choose a place, and the table under the panel lists sunrise, sunset, day length, the change from the day before and solar noon for every day of the month, in the place's own time zone. Use −1 month and +1 month to move, click a day to show it on the map, or press "The month as CSV" to download it with civil twilight.

How accurate are the sunrise and sunset times in the table?

Against the PyEphem ephemeris the calculation is off by 1.4 seconds in the median and at most about half a minute, and the table rounds to the nearest minute, as almanacs do. The times assume a flat horizon at sea level and normal refraction: hills, buildings and unusual air can move the sunrise you actually see by several minutes, and far north and south even more.

Why is the earliest sunset not on the shortest day?

Because solar noon is not fixed. Through December the equation of time moves it about 30 seconds later each day, and near the solstice the day length hardly changes, so sunrise and sunset both drift later. The earliest sunset therefore comes one to two weeks before the shortest day and the latest sunrise one to two weeks after it. In London the earliest sunset is about 15:51 on 12 December and the latest sunrise about 08:06 on 30 December, while the shortest day is 21 December. "Daylight through the year" shows the dates for your place.

When is the longest day of the year where I live?

Choose your place and look under the month table: "Daylight through the year" gives the longest and shortest day with their length and date, and the earliest and latest sunrise and sunset. North of the equator the longest day is around 21 June, south of it around 21 December. In New York it is about 15 h 6 min, against 9 h 15 min on the shortest day; above the Arctic and Antarctic circles the tool counts the days of midnight sun and polar night instead.

When does the sun set at the end of my street, like Manhattanhenge?

Stand in the street and choose that point, then under "Sun over a landmark" pick a point at the far end of the street, where the view closes, and type the height of what is there – 0 m if you look at the ground or the horizon. The table lists the days the sun sets within 1° of that spot and marks the closest day of each run. For a Manhattan cross street pointing to azimuth 299°, with the view 0.5° above the horizon, the closest days in 2027 are 29 May and 13 July, the "Manhattanhenge" days of late May and mid July. A street lines up with the sunrise or the sunset only if it points within roughly 30° to 40° of due east or west at mid latitudes; other directions never get the sun at the horizon.

Why does the sun stand over the landmark for several days in a row?

The sun's daily path moves north or south only as fast as its declination changes: at most about 0.4° a day around the equinoxes and almost nothing near the solstices. The tool accepts the centre of the sun within 1° of the top, so around the equinoxes the sun stays in that window for about a week, and near a solstice for three weeks or more. The closest day is the one where the centre of the sun comes nearest the top, and the time moves by only a minute or so from day to day. The sun's disc is about 0.53° wide, so the landmark stands in front of the sun when the offset is under about 0.27°. Heights from Terrain Tiles can be a few metres off, so check them in the panel and type the landmark's real height.

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