Sun elevation angle from shadow calculator
Measure an upright object and its shadow to learn how high the Sun is: when both are 2 metres, the Sun stands at 45° above the horizon. A longer shadow means a lower Sun. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Height
- 2
- Shadow length
- 2
- Angle degrees
- 45
- Angle radians
- 0.7853981634
- Height to shadow ratio
- 1
This sun elevation angle calculator turns a vertical object's measured height and its horizontal shadow length into the Sun's apparent angle above the horizon. Enter both measurements in the same unit, such as metres, feet, or centimetres. The calculator divides height by shadow length and applies the inverse tangent, then reports the result in degrees and radians. It is useful for field observations, solar demonstrations, photography planning, garden studies, and quick checks of basic right-triangle measurements without needing a protractor or specialist instrument.
Measure the object and shadow consistently
Choose an object that is vertical, straight, and easy to measure, such as a pole, post, stake, or wall edge. Measure its height from the same ground plane on which the shadow falls. Then measure the shadow horizontally from the object's base to the shadow tip.
Both values must use the same length unit. A height of two metres with a shadow of three metres works, as does a height of 200 centimetres with a shadow of 300 centimetres, because the units cancel in the ratio. Avoid mixing feet with inches unless you convert one measurement first.
Soft edges, sloping terrain, a leaning object, or an object whose base is above the shadow surface can introduce measurement error. Enter positive values only: physical height and shadow length are lengths, and neither can be zero for this right-triangle calculation. The tool validates those conditions before calculating the angle.
Understand the inverse-tangent calculation
The object, its shadow, and the incoming sunlight form a right triangle under the simplified geometric model. The vertical height is the side opposite the Sun's elevation angle, while the shadow length is the adjacent side. Their ratio is therefore height divided by shadow length.
Applying the inverse tangent gives the angle: elevation equals arctangent of height over shadow. The calculator converts that result from radians to degrees, while also returning radians and the underlying ratio for technical workflows. If height and shadow are equal, the ratio is one and the elevation is 45 degrees.
A short shadow compared with the object produces a steep angle nearer 90 degrees; a long shadow produces a shallow angle nearer zero. The calculation assumes straight light rays, a vertical object, horizontal ground, and a shadow caused by direct sunlight. It does not correct for terrain slope, atmospheric refraction, the apparent size of the solar disc, or local obstructions.
Those effects are usually secondary to ordinary field measurement uncertainty.
Interpret and use the result responsibly
The reported angle describes the Sun's apparent elevation above an ideal local horizon at the measurement moment. It is not an azimuth, compass bearing, latitude, clock time, or forecast. Because the Sun moves continuously, repeat observations should record the time and location if you want meaningful comparisons.
For a classroom exercise, students can measure the same object at intervals and observe how the angle rises toward solar noon and later falls. Gardeners can compare approximate solar height with the reach of shadows across beds, while photographers can use a quick field reading to understand whether light is low and directional or high and compact. Results are only as accurate as the measurements.
A small error in locating the shadow tip can matter substantially when the shadow is short, so retain sensible precision rather than treating many decimal places as physical certainty. Never look directly at the Sun to perform this measurement; the object and its ground shadow provide all required information. For surveying, navigation, construction compliance, or safety-critical solar analysis, use calibrated instruments and appropriate professional methods instead.
What you can do with it
Run a solar geometry lesson
Measure a fixed pole throughout the day and convert each shadow into an elevation angle for comparison.
Estimate outdoor light direction
Use an object's shadow to quantify whether sunlight is low, moderate, or high above the horizon.
Record garden shadow conditions
Calculate approximate solar elevation alongside observations of how shadows cross planting areas.
FAQ
What formula does the calculator use?
It uses angle = arctangent(height / shadow length), then converts the angle from radians to degrees.
Must height and shadow use the same unit?
Yes. Use any length unit, but use that same unit for both values so their ratio is valid.
Why must the shadow length be greater than zero?
The formula divides by shadow length, so zero does not define a finite right-triangle ratio for this calculator.
Does this return the Sun's compass direction?
No. It returns elevation above the horizon, not azimuth or compass bearing.
What does an equal height and shadow mean?
Their ratio is one, so the calculated Sun elevation angle is 45 degrees.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/trig/sun-angle-from-shadow \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"height":2,"shadow_length":2}'const res = await fetch("https://api.kit.forhosting.com/trig/sun-angle-from-shadow", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"height": 2,
"shadow_length": 2
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/trig/sun-angle-from-shadow",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"height": 2,
"shadow_length": 2
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/trig/sun-angle-from-shadow", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"height":2,"shadow_length":2}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"height":2,"shadow_length":2}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/trig/sun-angle-from-shadow", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"height": 2,
"shadow_length": 2
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "trig.sun_angle_from_shadow",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Measure the object and shadow consistently
For the best practical result, work on level ground and identify a crisp shadow endpoint.
Technical questions
How much does the API calculation cost?
Each API request costs $0.002; the browser calculator can run the same deterministic calculation locally.