An autocalibration algorithm for calibration of magnetometer triads used to determine heading in small aerial vehicles is developed and its performance is analyzed. The algorithm estimates the 12 calibration parameters, which are elements of an affine transformation mapping measured, and thus, erroneous magnetometer measurements into corrected field measurements. The mapping corrects magnetometer output errors due to hard-iron biases, scale factor deviations, and nonorthogonality effects caused by soft irons or physical arrangement of the sensor axes. The correction mapping is determined by leveraging the fact that the locus of Earth's magnetic field vector as measured by a triad of magnetometers is an ellipsoid. The coefficients defining the ellipsoid are computed using a total leastsquares estimator. It is shown that, generally, in such autocalibration algorithms, soft-iron errors and sensing axes nonorthogonality can result in an error mode that is unobservable. These conditions are identified and the algorithm incorporates a method for detecting them. In these instances, even though autocalibration can provide an estimate of only 9 of the 12 calibration parameters, it is shown that how external measurements from a triad of accelerometers and a global positioning system receiver can provide the information needed to estimate the unobservable error mode.