**Atmospheric refraction** is the deviation of light or other electromagnetic wave from a straight line as it passes through the atmosphere due to the variation in air density as a function of height. This refraction is due to the velocity of light through air decreasing (the index of refraction increases) with increased density. Atmospheric refraction near the ground produces mirages and can make distant objects appear to shimmer or ripple, elevated or lowered, stretched or shortened with no mirage involved. The term also applies to the refraction of sound. Atmospheric refraction is considered in measuring the position of both astronomical and terrestrial objects.

Astronomical or celestial refraction causes astronomical objects to appear higher in the sky than they are in reality. Terrestrial refraction usually causes terrestrial objects to appear higher than they really are, although in the afternoon when the air near the ground is heated, the rays can curve upward making objects appear lower than they really are.

Refraction not only affects lightrays but all electromagnetic radiation, although in varying degrees (see dispersion in optics). For example, in visible light, blue is more affected than red. This may cause astronomical objects to be spread out into a spectrum in high-resolution images.

Whenever possible, astronomers will schedule their observations around the time of culmination of an object when it is highest in the sky. Likewise sailors will never shoot a star which is not at least 20° or more above the horizon. If observations close to the horizon cannot be avoided, it is possible to equip a telescope with control systems to compensate for the shift caused by the refraction. If the dispersion is a problem too, (in case of broadband high-resolution observations) atmospheric refraction correctors can be employed as well (made from pairs of rotating glass prisms). But as the amount of atmospheric refraction is a function of the temperature gradient, the temperature, pressure, and humidity (the amount of water vapour is especially important at mid-infrared wavelengths) the amount of effort needed for a successful compensation can be prohibitive. Surveyors, on the other hand, will often schedule their observations in the afternoon when the magnitude of refraction is minimum.

Atmospheric refraction becomes more severe when there are strong temperature gradients, and refraction is not uniform when the atmosphere is inhomogeneous, as when there is turbulence in the air. This is the cause of twinkling of the stars and various deformations of the shape of the sun at sunset and sunrise.

**Astronomical refraction** deals with the angular position of celestial bodies, their appearance as a point source, and through differential refraction, the shape of extended bodies such as the Sun and Moon.

Atmospheric refraction of the light from a star is zero in the zenith, less than 1′ (one arc-minute) at 45° apparent altitude, and still only 5.3′ at 10° altitude; it quickly increases as altitude decreases, reaching 9.9′ at 5° altitude, 18.4′ at 2° altitude, and 35.4′ at the horizon; all values are for 10 °C and 1013.25 hPa in the visible part of the spectrum.

On the horizon refraction is slightly greater than the apparent diameter of the Sun, so when the bottom of the sun's disc appears to touch the horizon, the sun's true altitude is negative. If the atmosphere suddenly vanished, the sun would too. By convention, sunrise and sunset refer to times at which the Sun’s upper limb appears on or disappears from the horizon and the standard value for the Sun’s true altitude is −50′: −34′ for the refraction and −16′ for the Sun’s semi-diameter. The altitude of a celestial body is normally given for the center of the body’s disc. In the case of the Moon, additional corrections are needed for the Moon’s horizontal parallax and its apparent semi-diameter; both vary with the Earth–Moon distance.

Refraction near the horizon is highly variable, principally because of the variability of the temperature gradient near the Earth's surface and the geometric sensitivity of the nearly horizontal rays to this variability. As early as 1830, Friedrich Bessel had found that even after applying all corrections for temperature and pressure (but not for the temperature gradient) at the observer, highly precise measurements of refraction varied by ±0.19' at two degrees above the horizon and by ±0.50' at a half degree above the horizon. At and below the horizon, values of refraction significantly higher than the nominal value of 35.4′ have been observed in a wide range of climates. Georg Constantin Bouris measured refraction of as much of 4° for stars on the horizon at the Athens Observatory and, during his ill-fated Endurance expedition, Sir Ernest Shackleton recorded refraction of 2°37':

“The sun which had made ‘positively his last appearance’ seven days earlier surprised us by lifting more than half its disk above the horizon on May 8. A glow on the northern horizon resolved itself into the sun at 11 am that day. A quarter of an hour later the unreasonable visitor disappeared again, only to rise again at 11:40 am, set at 1 pm, rise at 1:10 pm and set lingeringly at 1:20 pm. These curious phenomena were due to refraction which amounted to 2° 37' at 1:20 pm. The temperature was 15° below 0° Fahr., and we calculated that the refraction was 2° above normal.”

Day-to-day variations in the weather will affect the exact times of sunrise and sunset as well as moon-rise and moon-set, and for that reason it generally is not meaningful to give rise and set times to greater precision than the nearest minute. More precise calculations can be useful for determining day-to-day changes in rise and set times that would occur with the standard value for refraction if it is understood that actual changes may differ because of unpredictable variations in refraction.

Because atmospheric refraction is nominally 34′ on the horizon, but only 29′ at 0.5° above it, the setting or rising sun seems to be flattened by about 5′ (about 1/6 of its apparent diameter).

Young distinguished several regions where different methods for calculating astronomical refraction were applicable. In the upper portion of the sky, with a zenith distance of less than 70° (or an altitude over 20°), various simple refraction formulas based on the index of refraction (and hence on the temperature, pressure, and humidity) at the observer are adequate. Between 20° and 5° of the horizon the temperature gradient becomes the dominant factor and numerical integration, using a method such as that of Auer and Standish and employing the temperature gradient of the standard atmosphere and the measured conditions at the observer, is required. Closer to the horizon, actual measurements of the changes with height of the local temperature gradient need to be employed in the numerical integration. Below the astronomical horizon, refraction is so variable that only crude estimates of astronomical refraction can be made; for example, the observed time of sunrise or sunset can vary by several minutes from day to day. As *The Nautical Almanac* notes, "the actual values of …the refraction at low altitudes may, in extreme atmospheric conditions, differ considerably from the mean values used in the tables."

Many different formulas have been developed for calculating astronomical refraction; they are reasonably consistent, differing among themselves by a few minutes of arc at the horizon and becoming increasingly consistent as they approach the zenith. The simpler formulations involved nothing more than the temperature and pressure at the observer, powers of the cotangent of the *apparent* altitude of the astronomical body and in the higher order terms, the height of a fictional homogeneous atmosphere. The simplest version of this formula, which Smart held to be only accurate within 45° of the zenith, is:

R
=
(
n
0
−
1
)
cot
h
a
,
where *R* is the refraction in radians, *n*_{0} is the index of refraction at the observer (which depends on the temperature and pressure), and *h*_{a} is the *apparent* altitude of the astronomical body.

An early simple approximation of this form, which directly incorporated the temperature and pressure at the observer, was developed by George Comstock:

R
=
21.5
b
273
+
t
cot
h
a
,
where *R* is the refraction in seconds of arc, *b* is the barometric pressure in millimeters of mercury, and *t* is the Celsius temperature. Comstock considered that this formula gave results within one arcsecond of Bessel's values for refraction from 15° above the horizon to the zenith.

A further expansion in terms of the third power of the cotangent of the apparent altitude incorporates *H*_{0}, the height of the homogenous atmosphere, in addition to the usual conditions at the observer:

R
=
(
n
0
−
1
)
(
1
−
H
0
)
cot
h
a
−
(
n
0
−
1
)
[
H
0
−
1
2
(
n
0
−
1
)
]
cot
3
h
a
.
A version of this formula is used in the International Astronomical Union's *Standards of Fundamental Astronomy*; a comparison of the IAU's algorithm with more rigorous ray-tracing procedures indicated an agreement within 60 milliarcseconds at altitudes above 15°.

Bennett developed another simple empirical formula for calculating refraction from the apparent altitude which gives the refraction *R* in arcminutes:

R
=
cot
(
h
a
+
7.31
h
a
+
4.4
)
.
This formula is used in the U. S. Naval Observatory's *Vector Astrometry Software*, and is reported to be consistent with Garfinkel's more complex algorithm within 0.07′ over the entire range from the zenith to the horizon. Sæmundsson developed an inverse formula for determining refraction from *true* altitude; if *h* is the true altitude in degrees, refraction *R* in arcminutes is given by

R
=
1.02
cot
(
h
+
10.3
h
+
5.11
)
;
the formula is consistent with Bennett’s to within 0.1′. The formulas of Bennet and Sæmundsson assume an atmospheric pressure of 101.0 kPa and a temperature of 10 °C; for different pressure *P* and temperature *T*, refraction calculated from these formulas is multiplied by

P
101
283
273
+
T
Refraction increases approximately 1% for every 0.9 kPa increase in pressure, and decreases approximately 1% for every 0.9 kPa decrease in pressure. Similarly, refraction increases approximately 1% for every 3 °C decrease in temperature, and decreases approximately 1% for every 3 °C increase in temperature.

Turbulence in the atmosphere scatters the light from stars, making them appear brighter and fainter on a time-scale of milliseconds. The slowest components of these fluctuations are visible as twinkling (also called "scintillation").

Turbulence also causes small random motions of the star image, and produces rapid changes in its structure. These effects are not visible to the naked eye, but are easily seen even in small telescopes. They are called "seeing" by astronomers.

**Terrestrial refraction**, sometimes called **geodetic refraction**, deals with the apparent angular position and measured distance of terrestrial bodies. It is of special concern for the production of precise maps and surveys. Since the line of sight in terrestrial refraction passes near the earth's surface, the magnitude of refraction depends chiefly on the temperature gradient near the ground, which varies widely at different times of day, seasons of the year, the nature of the terrain, the state of the weather, and other factors.

As a common approximation, terrestrial refraction is considered as a constant bending of the ray of light or line of sight, in which the ray can be considered as describing a circular path. A common measure of refraction is the coefficient of refraction. Unfortunately there are two different definitions of this coefficient. One is the ratio of the radius of the Earth to the radius of the line of sight, the other is the ratio of the angle that the line of sight subtends at the center of the Earth to the angle of refraction measured at the observer. Since the latter definition only measures the bending of the ray at one end of the line of sight, it is one half the value of the former definition.

The coefficient of refraction is directly related to the local vertical temperature gradient and the atmospheric temperature and pressure. The larger version of the coefficient *k*, measuring the ratio of the radius of the Earth to the radius of the line of sight, is given by:

k
=
503
P
T
2
(
0.0343
+
d
T
d
h
)
,
where temperature *T* is given in degrees Kelvin, pressure *P* in millibars, and height *h* in meters. The angle of refraction increases with the coefficient of refraction and with the length of the line of sight.

Although the straight line from your eye to a distant mountain might be blocked by a closer hill, the ray may curve enough to make the distant peak visible. A convenient method to analyze the effect of refraction on visibility is to consider a reduced effective radius of the Earth *R*_{eff}, given by

R
e
f
f
=
R
1
−
k
,
where *R* is the radius of the Earth and *k* is the coefficient of refraction. Under this model the ray can be considered a straight line on an Earth of increased radius.

The curvature of the refracted ray in arc seconds per meter can be computed using the relationship

1
σ
=
16.3
P
T
2
(
0.0342
+
d
T
d
h
)
cos
β
where 1/σ is the curvature of the ray, *P* is the pressure in millibars, *T* is the temperature in degrees Kelvin, and β is the angle of the ray to the horizontal. Multiplying the curvature by the length of the ray path gives the angle of refraction at the observer. For a line of sight near the horizon cos β differs little from unity and can be ignored. This yields

Ω
=
16.3
L
P
T
2
(
0.0342
+
d
T
d
h
)
,
where *L* is the length of the line of sight and Ω is the refraction at the observer measured in arc seconds.

A simple approximation is to consider that a mountain's apparent altitude at your eye (in degrees) will exceed its true altitude by its distance in kilometers divided by 1500. This assumes a fairly horizontal line of sight and ordinary air density; if the mountain is very high (so much of the sightline is in thinner air) divide by 1600 instead.