Sun Position Calculator - See Solar Coordinates and a Sky Dome Visualization

Written by:
PK

The Sun Position Calculator delivers professional-grade azimuth and altitude data for any location, date, and time.

Features of the Sun Position Calculator

Get your solar positioning with data and a side of visuals:

  • Dual interface modes: Switch between detailed Table view for coordinates and an interactive Sky Dome View for visual sun tracking.
  • Real-time sky dome: Interactive stereographic projection showing the sun's exact position on a hemispherical view of the sky… just like looking up through a fishbowl.
  • Live time slider: Drag through any day from midnight to midnight with AM/PM labels to see the sun's complete daily journey.
  • Precise coordinates: Solar azimuth and altitude in decimal degrees with magnetic declination correction.
  • Phase-aware display: Current sun conditions from astronomical night through civil dawn, daylight, golden hour, and all twilight phases.
  • Location flexibility: City search with worldwide locations pre-populated, GPS auto-detection, or direct latitude/longitude entry.
  • Professional exports: CSV or JSON data with timestamps and metadata.
  • Atmospheric corrections: Optional refraction adjustments and air mass calculations for precision work.

The Sky Dome View includes a time-responsive sun path that dims during astronomical night (when the sun is more than 18° below the horizon) and becomes more pronounced during daylight hours.

Understanding sun position coordinates

Solar positioning uses two primary angles that work together like geographic coordinates for the sky:

Azimuth: compass direction

Azimuth measures the sun's compass bearing from true north (0°), moving clockwise through east (90°), south (180°), and west (270°). The calculator provides both true azimuth (based on geographic north) and magnetic azimuth (corrected for your location's magnetic declination).

Altitude: elevation angle

Altitude (or elevation) measures how high the sun appears above the horizon - 0° means the sun is right at the horizon line, 90° would be directly overhead (the zenith), and negative values indicate the sun is below the horizon.

The calculator also accounts for atmospheric refraction, which makes the sun appear slightly higher than its geometric position (especially near the horizon).

Sun phases and lighting conditions

Beyond coordinates, the calculator shows the current sun phase - from astronomical night (sun more than 18° below horizon) through the various twilight phases, golden hour, blue hour, and full daylight.

Methodology and accuracy

Solar position calculations use the SunCalc.js library.

Atmospheric refraction correction uses the Bennett formula (Journal of Navigation, 1982), adjusted for local atmospheric conditions:

R = \frac{1.02}{\tan(a + \frac{10.3°}{a + 5.11°})} \times \frac{P}{1010} \times \frac{283}{273 + T}

Where R is refraction in arcminutes, a is the apparent altitude, P is atmospheric pressure (hPa), and T is temperature (°C).

Air mass calculation follows the Kasten-Young formula (Applied Optics, 1989) with atmospheric refraction correction:

AM = \frac{1}{\cos(\theta_z) + 0.50572 \times (96.07995 - \theta_z)^{-1.6364}}

Where θ_z is the solar zenith angle in degrees.

Magnetic declination uses a simplified World Magnetic Model (WMM2020) with secular variation corrections. The implementation includes the primary harmonic coefficients (n≤2) with linear time variation from the 2020.0 epoch.

Location data draws from the cities.json database covering 150,000+ worldwide locations.

And now, the caveats: while accurate for most applications and a reasonable starting point, verify the quick calculations somewhere else. Atmospheric conditions, local terrain, and equipment introduce additional variables – it's a simplified starting point at the end of the day.

      

PK

PK started DQYDJ in 2009 to research and discuss finance and investing and help answer financial questions. He's expanded DQYDJ to build visualizations, calculators, and interactive tools.

PK lives in New Hampshire with his wife, kids, and dog.

Don't Quit Your Day Job...

DQYDJ may be compensated by our partners if you make purchases through links. See our disclosures page. As an Amazon Associate we earn from qualifying purchases.
Sign Up For Emails
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram