What this calculator does
This tool computes the position of the Sun in the sky throughout a single day at any location on Earth. For each hour of local clock time it returns the solar elevation (altitude above the horizon, negative when the Sun is below it) and the azimuth (compass direction, measured clockwise from North: North = 0 degrees, East = 90, South = 180, West = 270). The astronomy is universal; only the default coordinates (Tokyo) and the default time-zone offset (+9, Japan) are region specific, so change them for your own site.
How to use it
Enter your longitude (East positive, West negative), latitude (North positive, South negative), your standard-time offset from UTC (for example New York standard time is -5), and the calendar date. The calculator sweeps local clock time from 0 to 24 hours and prints one row per hour. The headline value is the elevation and azimuth at local 12:00.
The formula explained
From the Gregorian date we form a Julian day number, then the days since the J2000.0 epoch. A low-precision series gives the Sun's mean longitude, mean anomaly and apparent ecliptic longitude; combined with the obliquity of the ecliptic these yield the declination and right ascension. Greenwich Mean Sidereal Time plus your longitude gives local sidereal time, and subtracting the right ascension gives the hour angle \(H\). Finally the spherical-triangle relations convert (declination, \(H\), latitude) into elevation and azimuth.
$$h = \arcsin\!\Big( \sin\phi \, \sin\delta + \cos\phi \, \cos\delta \, \cos H \Big)$$ $$\text{where}\quad \left\{ \begin{aligned} \phi &= \text{Latitude} \\ H &= \theta_G + \text{Longitude} - \alpha \\ \delta,\ \alpha &= \text{Sun declination and right ascension at UT} \\ \text{UT} &= t - \text{UTC Offset} \end{aligned} \right.$$ $$A = \operatorname{atan2}\!\Big( -\cos\delta \, \sin H,\ \ \sin\delta \, \cos\phi - \cos\delta \, \sin\phi \, \cos H \Big)$$ $$\text{where}\quad \left\{ \begin{aligned} \phi &= \text{Latitude} \\ H &= \theta_G + \text{Longitude} - \alpha \end{aligned} \right.$$
Worked example
Tokyo (139.7447 E, 35.6544 N), zone +9, 15 June 2024. Near local solar noon the Sun's declination is about 23.3 degrees (close to the solstice maximum), so the noon elevation is roughly 90 minus the difference of latitude and declination, $$90 - (35.6544 - 23.3) \approx 77.6 \text{ degrees},$$ with an azimuth near 180 degrees (due South). Early morning the Sun is low in the east; in the evening it is low in the west.
FAQ
Why is the elevation negative at some hours? A negative elevation means the Sun is below the horizon: it is night, before sunrise or after sunset.
How accurate is it? The series fits are valid for years 1900 to 2099 and give a few arcseconds to a few arcminutes of error, with larger error at very high latitudes.
Which way is azimuth measured? Clockwise from due North, so 90 is East, 180 is South and 270 is West.