Magnetic deviation is the error induced in a compass by local magnetic fields, which must be allowed for, along with magnetic declination, if accurate bearings are to be calculated. (More loosely, "magnetic deviation" is used by some to mean the same as "magnetic declination". This article is about the former meaning.)
Compasses are used to determine the direction of true North. However, the compass reading must be corrected for two effects. The first is magnetic declination or variation—the angular difference between magnetic North (the local direction of the Earth's magnetic field) and true North. The second is magnetic deviation—the angular difference between magnetic North and the compass needle due to nearby sources of interference such as magnetically permeable bodies, or other magnetic fields within the field of influence.
The Earth's magnetic field is modified by local magnetic anomalies. These include variations of the magnetization in the Earth's crust caused by geomagnetic reversals as well as nearby mountains and iron ore deposits. Generally, these are indicated on maps as part of the declination. Because the Earth's field changes over time, the maps must be kept up to date for accurate navigation. Short term errors in compass readings are also caused by fields generated in the Earth's magnetosphere, particularly during geomagnetic storms.
In navigation manuals, magnetic deviation often refers specifically to compass error caused by magnetized iron within a ship or aircraft. This iron has a mixture of permanent magnetization and an induced (temporary) magnetization that is induced by the Earth's magnetic field. Because the latter depends on the orientation of the craft relative to the Earth's field, it can be difficult to analyze and correct for it.
The deviation errors caused by magnetism in the ship's structure are minimised by precisely positioning small magnets and iron compensators close to the compass. To compensate for the induced magnetization, two magnetically soft iron spheres are placed on side arms. However, because the magnetic "signature" of every ship changes slowly with location, and with time, it is necessary to adjust the compensating magnets, periodically, to keep the deviation errors to a practical minimum. Magnetic compass adjustment and correction is one of the subjects in the examination curriculum for a shipmaster's certificate of competency.
The sources of magnetic deviation vary from compass to compass or vehicle to vehicle. However, they are independent of location, and thus the compass can be calibrated to accommodate them.
Non-magnetic methods of taking bearings, such as with gyrocompass, astronomical observations, satellites (as GPS) or radio navigation, are not subject to magnetic deviation. Thus, a comparison of bearings taken with such methods with the bearing given by a compass can be used to compute local magnetic deviation.
Sailing ships generally had two kinds of compasses: steering compasses, two of which would be mounted in a binnacle in front of the helm for use in maintaining a course; and a bearing compass that was used for taking the bearings of celestial objects, landmarks and the ship's wake. The latter could be moved around the ship, and it was soon observed that the bearing could vary from one part of the ship to another. The explorer Joao de Castro was the first to report such an inconsistency, in 1538, and attributed it to the ship's gun. Many other objects were found to be sources of deviation in ships, including iron particles in brass compass bowls; iron nails in a wooden compass box or binnacle; and metal parts of clothing. The two steering compasses themselves could interfere with each other if they were set too close together. The "bearing compass" was eventually sited in a fixed position in a binicale with, as far as possible, an all round view and acquired the name "standard compass" It would nonetheless have a different deviation to the "steering compass" so the compass heading shown on the "steering compass" would be different to the compass heading shown on the "standard compass".
The source of deviation could not always be identified. To reduce this source of error, which was due to induced magnetization in the ship, the surveyor John Churchman proposed a solution known as swinging the ship in 1794. This involved measuring the magnetic deviation as the ship was oriented in several compass directions. These measurements could then be used to correct compass readings. This procedure became standard practice in the 19th century as iron became an increasing component of ships.
Compass Deviation is caused by local magnetic effects. On ships  and aircraft  the difference between North indicated by the compass, "Compass North" and "Magnetic North" (i.e. the direction of the Magnetic North Pole) is called Deviation. Variation is the difference between "Magnetic North" and "True North" and is dealt with elsewhere. The combined result of Deviation and Variation is called Compass Error.
- Admiralty Manual of Navigation Vol 1 1964 p12
- Doerfler, Ron (April 18, 2009). "Magnetic Deviation: Comprehension, Compensation and Computation (Part I)". Dead reckonings: Lost art in the mathematical sciences. Retrieved 10 March 2012.
- Dodds, Don (2001). Modern seamanship : a comprehensive ready-reference guide for all recreational boaters. Guilford, Conn.: The Lyons Press. ISBN 9781585745289.
- National Geospatial-Intelligence Agency (2004). "Handbook of magnetic compass adjustment" (PDF). Archived from the original (PDF) on 25 October 2011. Retrieved 10 March 2012.
- * Jonkers, A.R.T. (2003). The Earth's magnetism in the age of sail. Baltimore: Johns Hopkins University Press. pp. 168–169. ISBN 0801871328.
- Admiralty Manual of Navigation1964 Vol 1p14
- Air Pilot's Manual 3 Trevor Thom p33
- Admiralty Manual of Navigation 1964 Vol 1 p14
- Doerfler, Ron (April 18, 2009). "Magnetic Deviation: Comprehension, Compensation and Computation (Part II)". Dead reckonings: Lost art in the mathematical sciences. Retrieved 10 March 2012.