Solar Azimuth Calculator

Last Updated: August 6, 2026

Calculate the solar azimuth angle, the sun’s compass bearing clockwise from true north, plus elevation, sunrise, sunset, and shadow direction for any latitude, longitude, date, and clock time.

Required: latitude, longitude, date, local clock time, and UTC offset.

Method: calculate the sun’s true-north azimuth and elevation with the NOAA solar-position equations.

North is positive; south is negative.

East is positive; west is negative.

Examples: 90 east, 180 south, and 270 west.

Solar Azimuth Formula

Solar azimuth is the compass bearing of the sun measured clockwise from true north. Getting it takes four steps: turn the date into a fractional year angle, get the sun’s declination and the equation of time from that angle, convert your clock time into true solar time for your longitude, and then apply spherical trigonometry with your latitude. The calculator uses the NOAA general solar position equations for all of it.

Step 1, the fractional year angle in radians:

gamma = (2 × pi / Dy) × (N - 1 + (H - 12) / 24)

Step 2, the solar declination in radians and the equation of time in minutes:

delta = 0.006918 - 0.399912 × cos(gamma) + 0.070257 × sin(gamma) - 0.006758 × cos(2 × gamma) + 0.000907 × sin(2 × gamma) - 0.002697 × cos(3 × gamma) + 0.00148 × sin(3 × gamma)
EoT = 229.18 × (0.000075 + 0.001868 × cos(gamma) - 0.032077 × sin(gamma) - 0.014615 × cos(2 × gamma) - 0.040849 × sin(2 × gamma))

Step 3, true solar time and the hour angle:

TST = t + EoT + 4 × L - 60 × Z
HA = TST / 4 - 180

Step 4, solar elevation and then solar azimuth:

sin(alpha) = sin(phi) × sin(delta) + cos(phi) × cos(delta) × cos(HA)
cos(Az) = (sin(delta) - sin(phi) × sin(alpha)) / (cos(phi) × cos(alpha))

That inverse cosine only returns values from 0 to 180 degrees, so the afternoon half of the sky needs one correction:

Az = 360 - Az when HA > 0

Sunrise and sunset use the hour angle at a zenith of 90.833 degrees, which accounts for refraction and the radius of the solar disk:

HA0 = arccos(cos(90.833) / (cos(phi) × cos(delta)) - tan(phi) × tan(delta))

Shadow length and shadow bearing follow directly from elevation and azimuth:

Ls = h / tan(alpha) Azs = Az + 180
  • Az = solar azimuth in degrees clockwise from true north (0 = north, 90 = east, 180 = south, 270 = west)
  • alpha = solar elevation angle above the horizon in degrees, and 90 – alpha is the zenith angle
  • phi = your latitude in degrees, positive north
  • delta = solar declination in degrees, ranging from -23.44 to +23.44 over the year
  • HA = hour angle in degrees, negative before solar noon and positive after it, changing 15 degrees per hour
  • gamma = fractional year angle in radians
  • N = day of the year, 1 on January 1
  • Dy = days in the year, 365 or 366
  • H = the hour of the day in local clock time
  • EoT = equation of time in minutes, the gap between clock noon and true solar noon caused by the tilt and eccentricity of the orbit
  • TST = true solar time in minutes past local midnight
  • t = your clock time in minutes past midnight
  • L = your longitude in degrees, positive east
  • Z = the UTC offset of your clock in hours, positive east
  • HA0 = the hour angle of sunrise, which is also half the day length expressed in degrees
  • Ls = shadow length, h = object height, Azs = the bearing the shadow points toward

Each mode of the calculator uses a different slice of that chain. The position mode runs the full chain once and reports azimuth, elevation, zenith, hour angle, declination, equation of time, solar noon, sunrise, sunset, and day length for one instant. The sun path mode repeats the chain at a fixed interval and lists every daylight step, which is what you need to check where the sun will be over the course of a build day or a shoot. The time-of-azimuth mode runs the chain in reverse: it sweeps the whole day one minute at a time, finds the moments the azimuth crosses the bearing you entered, and interpolates the exact clock time. The panel mode drops time entirely, since the best year round bearing for a fixed array depends only on which hemisphere you are in, and pairs it with a tilt derived from your latitude.

Sun Bearings and Panel Orientation Reference

The first table shows where the sun actually clears the horizon through the year. Sunrise azimuth is not 90 degrees except near the equinoxes, and the spread between the June and December bearings widens quickly as you move away from the equator. Sunset azimuth is the mirror of sunrise, so it equals 360 minus the sunrise value.

Latitude (N)Sunrise azimuth Jun 21Sunrise azimuth Mar 20Sunrise azimuth Dec 21Noon elevation Jun 21 / Dec 21
2563.590.2115.688.5 / 41.6
3560.390.0118.478.5 / 31.6
4554.789.9123.268.5 / 21.6
5544.489.7132.358.5 / 11.6

All bearings are degrees clockwise from true north, computed at the refraction corrected horizon. In the southern hemisphere the same numbers apply with the seasons swapped, and the noon bearing becomes 0 rather than 180.

The second table is what the azimuth number is usually for: pointing a fixed solar array. Facing is far more forgiving than most people expect, because the loss curve is flat near the optimum and only bites past about 45 degrees of error.

Azimuth error from true southApproximate annual yieldPractical note
0 degrees100%Reference case for a fixed array at latitude tilt
15 degrees east or westabout 99%Not worth re-racking a roof to fix
30 degrees east or westabout 97%A west bias here often pays under time-of-use rates
45 degrees east or westabout 93%Typical for a house at 45 degrees to the street grid
60 degrees east or westabout 89%Consider a lower tilt to recover some loss
90 degrees east or westabout 80%Due east or due west roof face, still usually viable

Example Problems

Example 1. Find the solar azimuth in Denver at 2:00 PM on June 21, 2026. Latitude is 39.74, longitude is -104.98, the standard offset is -7 hours, and daylight saving is in effect so the clock offset is -6.

June 21 is day 172, which gives a declination of 23.45 degrees and an equation of time of -1.35 minutes. The clock time is 840 minutes past midnight, so the time offset is -1.35 + 4(-104.98) – 60(-6) = -61.27 minutes and true solar time is 778.7 minutes, or 12:59 solar. The hour angle is 778.7/4 – 180 = 14.68 degrees, which is just past solar noon.

Elevation: sin(alpha) = sin(39.74)sin(23.45) + cos(39.74)cos(23.45)cos(14.68) = 0.2544 + 0.6824 = 0.9368, so alpha = 69.5 degrees.

Azimuth: cos(Az) = (0.3979 – 0.6394 x 0.9368) / (0.7689 x 0.3497) = -0.748, so Az = 138.4 degrees. The hour angle is positive, so the sun is west of the meridian and the answer is 360 – 138.4 = 221.6 degrees, a southwest bearing. A 6 foot post at that moment casts a 2.24 foot shadow pointing at 41.7 degrees, toward the northeast.

Example 2. Find the solar azimuth in London at 9:00 AM GMT on March 20, 2026. Latitude is 51.51, longitude is -0.13, and the offset is 0.

March 20 is day 79, giving a declination of -0.51 degrees and an equation of time of -8.20 minutes. The time offset is -8.20 + 4(-0.13) = -8.71 minutes, so true solar time is 531.3 minutes and the hour angle is -47.18 degrees, well before noon. Elevation works out to 24.6 degrees. Then cos(Az) = (-0.0089 – 0.7828 x 0.4161) / (0.6223 x 0.9093) = -0.591, so Az = 126.3 degrees. The hour angle is negative, so no correction is applied and the sun sits at 126 degrees, southeast.

Frequently Asked Questions

Is solar azimuth measured from north or from south?

Both conventions are in use, which is the single most common source of wrong answers. This calculator uses the navigation and NOAA convention: 0 degrees is true north and the angle increases clockwise, so east is 90, south is 180, and west is 270. Much of the solar engineering and building science literature instead uses a south-zero convention where due south is 0, west is positive, and east is negative. To convert a north-referenced azimuth to that system, subtract 180 and wrap the result into the range -180 to +180. A north-referenced 221.6 degrees becomes +41.6 degrees south-referenced, and a north-referenced 126.3 becomes -53.7.

Will the azimuth match what my compass shows?

No, not unless your magnetic declination happens to be zero. Solar azimuth is referenced to true north, while a magnetic compass points at the magnetic pole. True bearing equals magnetic bearing plus the local magnetic declination, counting east declination as positive. If the calculator says the sun is at 180 degrees and your area has 10 degrees of east declination, your compass will read 170 degrees when pointed at the sun. Phone compass apps usually apply this correction for you and report true bearings, but a hand compass does not. This matters most when you are setting a panel rack or an antenna, where a 10 degree error is real.

Does longitude change the azimuth?

Not directly. Azimuth depends on latitude, declination, and hour angle only. Longitude and the UTC offset exist in the formula purely to convert your clock time into true solar time. Two places on the same latitude will see the same azimuth at the same true solar time, but at different clock times, and the gap can be large. A city at the western edge of a time zone reaches solar noon almost an hour later on the clock than one at the eastern edge. This is also why the calculator asks for longitude and time zone separately rather than a single time value.