ForHosting KIT · Developer Utilities

Solar Elevation Angle Calculator

The solar elevation angle, also called sun altitude, describes how high the Sun appears above or below an observer’s astronomical horizon.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

This calculator applies the standard spherical astronomy equation to three angles: geographic latitude, solar declination, and solar hour angle. Enter each value in decimal degrees to receive the elevation in degrees and radians, the complementary solar zenith angle, and the sine term used by the calculation. A positive result places the Sun above the ideal horizon, zero marks the geometric horizon, and a negative result places its center below the horizon. The computation is deterministic and uses no location lookup, date service, atmospheric model, or network request.

How the solar elevation formula works

Solar elevation follows from the astronomical triangle formed by the celestial pole, the zenith, and the Sun. The calculator evaluates the equation sin elevation = sin latitude × sin declination + cos latitude × cos declination × cos hour angle. Latitude locates the observer north or south of the equator. Solar declination locates the Sun north or south of the celestial equator, varying seasonally between approximately the two solstitial limits. Hour angle expresses the Sun’s angular distance from the local meridian: it is zero at local solar noon, negative before that instant, and positive afterward. The inverse sine of the completed expression gives the elevation between minus ninety and plus ninety degrees. The result is also the Sun’s geometric altitude, measured from the ideal astronomical horizon to the center of the solar disk. Its complement to ninety degrees is the solar zenith angle. Small floating-point excursions outside the valid inverse-sine interval can occur at exact limiting geometries, so the implementation safely clamps the computed sine to the closed interval from minus one to one before applying the inverse function. This numerical safeguard does not alter ordinary results; it prevents a mathematically valid pole or zenith case from becoming an invalid machine value because of rounding noise.

Choosing and interpreting the three inputs

Supply latitude in decimal degrees from minus ninety to plus ninety, using positive numbers for locations north of the equator and negative numbers for locations south of it. Supply solar declination in the same signed convention. Declination is an astronomical coordinate, not the Sun’s compass bearing and not magnetic declination. If it is not already available from an ephemeris or a separate date-based solar-position calculation, obtain it before using this calculator. Finally, supply hour angle from minus one hundred eighty to plus one hundred eighty degrees. Zero represents transit across the local meridian, commonly called local solar noon; negative values denote the morning side and positive values the afternoon side. Because cosine is symmetric, equal-magnitude morning and afternoon hour angles produce equal geometric elevations when latitude and declination remain fixed. The output named solar_elevation_angle_degrees is the primary answer. sun_altitude_degrees repeats that value under a familiar astronomy term, while solar_elevation_angle_radians supports software and equations that use radians. solar_zenith_angle_degrees measures downward from the zenith rather than upward from the horizon. A positive altitude means the solar center is geometrically above the horizon, a value of zero means its center lies on the horizon, and a negative value means it is below. These statements describe ideal geometry and do not yet account for atmospheric refraction, terrain, buildings, or the apparent radius of the solar disk.

Accuracy, scope, and practical use

The calculation is exact for the supplied spherical coordinates within normal floating-point precision, but the usefulness of the answer depends on input quality and on the physical interpretation required. Latitude should describe the observing point, while declination and hour angle should refer to the same instant and astronomical convention. An inaccurate hour angle directly shifts the Sun along its daily arc, and an approximate declination introduces a seasonal position error. The calculator intentionally does not derive either quantity from a civil date, clock time, longitude, time zone, or equation-of-time correction. It also returns geometric rather than apparent elevation. Near the horizon, atmospheric refraction can raise the observed Sun by a substantial fraction of a degree, with the actual correction depending on pressure, temperature, and atmospheric structure. Sunrise and sunset predictions may additionally define the event using the upper limb instead of the center, so a zero-degree result is not automatically an official rise or set time. For engineering studies, the result can feed preliminary solar-panel incidence calculations, shading screens, daylight models, or educational diagrams, provided downstream work applies any needed azimuth, refraction, horizon-profile, and surface-orientation corrections. For repeated software use, the response exposes both the sine intermediate and rounded degree and radian forms, making it straightforward to inspect test cases and compare implementations. Each successful API calculation uses the published base price of $0.002, while the browser calculation can use the same pure algorithm without network access.

Solar geometry checks

Compute the Sun’s geometric altitude for a known observer latitude, declination, and solar hour angle.

Renewable energy models

Provide a verified elevation input for preliminary panel incidence, shading, and daylight calculations.

Astronomy education

Demonstrate how latitude, seasonal declination, and time from solar noon shape the Sun’s daily path.

Is solar elevation the same as sun altitude?

Yes. In this calculator both names mean the signed angle from the ideal astronomical horizon to the center of the Sun.

What units should I use for the inputs?

Enter latitude, solar declination, and hour angle in decimal degrees. The result includes elevation in both degrees and radians.

What hour angle corresponds to local solar noon?

Use zero degrees. Negative hour angles represent times before local solar noon, and positive angles represent times after it.

Does a zero-degree elevation give the observed sunrise or sunset?

Not necessarily. The formula gives geometric elevation for the solar center and does not include atmospheric refraction, the solar disk radius, or a local terrain horizon.

Does the calculator derive declination from a date?

No. It uses the solar declination supplied by the caller. Obtain declination and hour angle from a consistent ephemeris or solar-position method when starting from a date and location.

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.

POSThttps://api.kit.forhosting.com/trig/solar-elevation-angle

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.

curl -X POST https://api.kit.forhosting.com/trig/solar-elevation-angle \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"latitude":40,"solar_declination":20,"hour_angle":30}'
{
  "latitude": 40,
  "solar_declination": 20,
  "hour_angle": 30
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "trig.solar_elevation_angle",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →