The Barometric Formula describes the vertical distribution of the gas particles in the atmosphere of the earth, i.e. the change of air pressure and density with the altitude. One therefore speaks of a vertical pressure and density gradient, but due to the weather dynamics within the lower atmosphere can only be described by approximations in a mathematical way.
It can be roughly assumed that the air pressure near sea level decreases by one hectopascal hPa for every eight meters increase in altitude.
The Ideal Gas Law describes how pressure, density and temperature of the atmosphere are coupled. If two of the values are known, the third one can be calculated from them. Due to gravity, the atmosphere gets denser with decreasong altitude. The density is also dependent on the temperature, which can not be easily calculated. Therefore, in the International Standard Atmosphere a mean temperature gradient is determined. In this way, the density and pressure can be calculated uniquely depending on the altitude (or temperature).
The International Standard Atmosphere model divides the atmosphere into layers, each with a linear or constant temperature gradient. The temperature gradient is denoted as the lapse rate α. The temperature at any altitude can be calculated as follows:
(1) 
 
where^{'} 

The lapse rate and Reference Values are listed in the table at the bottom of the page.
The formulas for air pressure and air density must distinguish between two cases. In air layers with constant temperature (isothermal), a different formula applies than in layers with a linear temperature gradient. [1] [2]:
From sea level h_{ref} = 0 m up to an altitude of h = 11 km, the temperature curve is approximately linear. The formula for air pressure for a linear temperature gradient is:
(2) 
 
with  
where^{'} 

If we set the reference altitude to sea level h_{ref} = 0 m and assume a mean state for the atmosphere, as described by the International Standard Atmosphere (temperature T_{ref} = 15°C = 288.15 K, air pressure p_{ref} = 1013.25 hPa and temperature gradient α = −0.0065 K/m), we obtain the barometric formula for air pressure in the troposphere (valid until h = 11 km altitude):
This formula allows you to calculate the air pressure at a given altitude without knowing temperature and temperature gradient. However, the accuracy in is limited since the calculation is based on a mean atmosphere instead of the current atmospheric state.
The Reference Values are listed in the table at the bottom of the page.
From a reference altitude of h_{ref} = 11 km to an altitude of h = 20 km the air temperature is constant T_{ref}. The formula for air pressure, when the temperature is constant, is:
(3) 
 
with  
where^{'} 

The Reference Values are listed in the table at the bottom of the page.
According to the ideal gas law, the air density can be calculated according to the following formula from pressure and temperature. Since the pressure p(h) depends on the temperature gradient (isotherm (3) or linear temperature gradient (2)), this also applies to the density:
(4) 
 
where^{'} 

The molar mass is generally dependent on the air composition, which varies at different levels. For heights up to 100 km, however, the composition can be assumed to be constant.
If we substitude p(h) and T(h) with the corresponding formulas above we get the formulas listed in the Layer Model below.
Since in the standard model of the atmosphere a distinction is made between isothermal layers and layers with a linear temperature gradient, there are also two groups of corresponding formulas:
Linear Temperature Gradient 
Isotherm (T = const.)  
(5)  
(6)  
width  
(7)  
where^{'} 

In order to determine the static air pressure, the air density or the temperature of the air at a certain altitude, according to the model of the International Standard Atmosphere, one proceeds as follows:
For this calculations you can use the Calculator on this page.
For the air layers of the standard atmospheric model, the following reference values are determined:
i  Layer [m]  h_{ref} [m]  α_{i} [K/m]  T_{ref} [K]  ρ_{ref} [g/m^{3}]  p_{ref} [Pa] 

0  0  11,000  0  −0.0065  288.15  1225.00  101,325 
1  11,000  20,000  11,000  0.0  216.65  363.918  22,632.1 
2  20,000  32,000  20,000  0.001  216.65  88.0348  5474.89 
3  32,000  47,000  32,000  0.0028  228.65  13.2250  868.019 
4  47,000  51,000  47,000  0.0  270.65  1.42753  110.906 
5  51,000  71,000  51,000  −0.0028  270.65  0.861605  66.9389 
6  71,000  84,852  71,000  −0.0020  214.65  0.0642110  3.95642 
The following calculator works up to an altitude of h ≤ 84,852 m with an accuracy of 5 digits. The values are calculated using the formulas on this page, i.e. it is calculated with the Layer Model.
The JavaScript of the calculator can be shown at JavaScript Barometric Formula.