Does Magnetic Deviation depend on altitude?

Magnetic declination, sometimes called magnetic variation, is the angle between magnetic north and true north. Declination is positive east of true north and negative when west. Magnetic declination changes over time and with location. As the compass points with local magnetic fields, declination value is needed to obtain true north.

This is the definition provided by National Center For Environmental Information.

As you can read, magnetic declination depends on location (lat/lon) and time but I would like to know if it also depends on the altitude and why it does or does not.

Note: possibly attach some reference to the answer.

Technically yes, but practically, usually no.

The magnetic field varies in three dimensions and the variations are not parallel to the Earth's surface. However, horizontal distances varies usually on a larger magnitude than elevation and for everyday use, the declination is only based on horizontal position.

The common model for the Earth's magnetic field, IGRF-12 (International Geomagnetic Reference Field) uses the radial distance from the center of the Earth (r) in relation to the geomagnetic conventional Earth’s mean reference spherical radius (a). In other words, the elevation. (a/r) will usually be almost 1, and the difference is less than any other uncertainties in the measurements, e.g. deviation due to magnetic anomalies.

The magnetic field is often calculated by using the published model and this code. As you can see (the code is rather easy to read), the vertical component is used to estimate the magnetic field for every location.

Online calculators are often used to correct declination for navigational purposes:

• NOAA's calculator doesn't include elevation and is calculated at sea level.

• BGS's and GA's calculators does, but the elevation have a small impact on the declination. Try it to see!

Simpler models, e.g the dipol model also suggest how the magnetic declination varies with distance from the Earth's magnetic center. The approximation work rather well at low latitudes and at the Earth's surface. It can also be used to model Earth's magnetic field in an astronomical context.

Apart from declination, there is also an inclination to take into account. Near the magnetic poles, the compass needle will not be horizontal, but get a dip. This can make normal field compasses almost useless near the magnetic poles (trust me, I tried..).