Skip to main content

Sun shadow calculator

Length and direction of the shadow cast by an object, from the Sun’s altitude and azimuth calculated for a city, a date and a local time.

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

City search uses the Open-Meteo geocoding service.

Choose a city or use your location: the Sun’s position depends on the place and time zone.

Was this tool useful?

On this page

How does this tool work?

How long will the tree’s shadow be across the patio at 5 p.m. in September? Which way will the shadow of a wall, a pole or a planned garden shed fall? This calculator answers those questions from the actual position of the Sun. Enter the place, date, local time and the object’s height: the tool computes the Sun’s altitude above the horizon and its azimuth, then the length of the shadow on level ground and the direction in which it stretches. It also works the other way round, to estimate the height of a tree or building from its shadow.

The Sun’s position comes from NOAA’s general solar equations. The local clock time is first converted to true solar time, taking into account the time zone and daylight saving time, the longitude and the equation of time. That gives the hour angle, then the Sun’s altitude h and its azimuth A, measured clockwise from north.

On level ground, a vertical object of height H casts a shadow of length L = H ÷ tan(h). The shadow starts at the foot of the object and points away from the Sun, so its direction is A + 180°. With the Sun at 45° the shadow is as long as the object; at 30° it is 1.73 times its height; at 10°, 5.7 times.

The altitude is geometric: it leaves out atmospheric refraction, which lifts the Sun by about half a degree at the horizon. A few minutes before the official sunset, the tool may therefore already show the Sun below the horizon. The simplified equations place the Sun within a few tenths of a degree, which is enough for garden planning or photography but not for precision measurement when the Sun is very low.

How to calculate a cast shadow

  1. Set the place

    Search for a city or use your location; the time zone is picked up automatically.

  2. Choose the date and local time

    Use the clock time on site, daylight saving time included.

  3. Enter the object’s height

    In metres, from the ground to the highest point whose shadow you want.

  4. Read the result

    Shadow length and direction, shadow-to-height ratio, and the Sun’s altitude and azimuth.

Cast shadow formulas

The Sun’s altitude and azimuth follow from latitude, declination and hour angle; the shadow then follows from trigonometry.

Solar altitude

sin h = sin φ × sin δ + cos φ × cos δ × cos H

Shadow length

L = H_object ÷ tan h

Shadow direction

direction = (A + 180°) mod 360°

h
geometric altitude of the Sun above the horizon, in degrees
A
Sun azimuth, in degrees from true north (90° = east)
φ
latitude of the place
δ
declination of the Sun on the date
H
hour angle, zero at solar noon
H_object
height of the object, in metres
L
shadow length on level ground, in metres

If h ≤ 0 the Sun is below the horizon and there is no cast shadow.

Use cases

Garden and vegetable patch

Check whether a tree or fence will shade a flower bed in the afternoon, in spring as well as summer.

Patio, pergola and shade sail

Choose the orientation and height of a cover so it shades the table at the times you use it.

Solar panels

Estimate how far the shadow of a chimney or a neighbouring building reaches in winter, when the Sun is lowest.

Measuring a height from a shadow

Measure the shadow of a tree and read the shadow-to-height ratio: height = shadow length ÷ ratio.

Photography and filming

Anticipate the direction of the light and the length of shadows at a location.

Examples

Paris, 21 June 2026 at 12:00, 1 m stick

At noon on the clock the Sun has not yet peaked: in Paris in summer, solar noon falls around 13:52. At that time it culminates at 64.6° due south and the shadow is only 0.47 m long, pointing due north.

Input

Sun altitude 56.4°, azimuth 129° (SE)

Result

0.66 m shadow towards 309° (NW)

Paris, 21 December 2026 at 15:30, 10 m tree

In winter a low Sun stretches the shadow more than six times: a 10 m tree can shade a neighbouring plot 60 m away.

Input

Sun altitude 9.2°, azimuth 217° (SW)

Result

61.5 m shadow towards 37° (NE)

Sydney, 4 October 2026 at 12:44, 1.80 m person

In the southern hemisphere the midday Sun is in the north, so the shadow points south.

Input

Sun altitude 60.2°, azimuth 0° (N)

Result

1.03 m shadow towards 180° (S)

Tips and best practices

  • For a low wall or hedge, enter the height above the ground where the shadow falls; if the ground slopes up or down, the real shadow will be shorter or longer.
  • Try several times: the shortest shadow of the day is at solar noon, often well after 12:00 because of daylight saving time.
  • For a solar project, look at 21 December (or 21 June in the southern hemisphere), when midday shadows are longest.
  • A compass points to magnetic north, which differs from the true north used by the tool by a few degrees depending on the region.

Sources and references

Frequently asked questions

How do you calculate the length of a shadow?

Shadow length = object height ÷ tangent of the Sun’s altitude. With the Sun at 30°, a 2 m object casts 2 ÷ 0.577 = 3.46 m of shadow on level ground.

Which way does the shadow point?

Away from the Sun: shadow direction = Sun azimuth + 180°. In the morning the Sun is in the east and the shadow points west; in the northern hemisphere the midday shadow points north.

Why is the shadow shortest around 1 p.m. rather than at noon?

Because clock time is not solar time. In London, for example, the time zone, British Summer Time and the equation of time put solar noon anywhere from about 11:44 (early November) to 13:07 (late July).

Can I measure a tree’s height from its shadow?

Yes: measure the shadow on the ground, then divide by the shadow-to-height ratio shown for the same time and place. It is the method attributed to Thales for the pyramids, and it needs level ground.

Why does the tool say “Sun below the horizon” while it is still light?

The altitude is geometric, without refraction. The Sun stays visible about half a degree below the geometric horizon, i.e. a few minutes after the tool stops showing a shadow.

Does the tool account for buildings or terrain?

No. It assumes a clear horizon and level ground. A hill, a building or a slope changes the real length and can hide the Sun.

Related tools

Tools similar or complementary to this one.

Similar tools

Convert slope between percent, degrees, rise, length and ratio.

Dates & timeUse this tool

Calculate the direction of the Kaaba from your city or coordinates: bearing in degrees from true north and distance to Makkah.

Dates & timeUse this tool