A magnetic field sensor comprising: a plurality of magnetic field sensing elements; a coil driver configured to generate a coil drive signal; a coil structure coupled to the coil driver and configured to generate a reference magnetic field on each of the plurality of magnetic field sensing elements in response to the coil drive signal, wherein each of the plurality of magnetic field sensing elements is configured to generate an output signal responsive to the respective reference magnetic field and to external magnetic fields; a memory configured to store reference gains associated with the plurality of magnetic field sensing elements, wherein the reference gains include a predetermined ratio of gains between two or more of the magnetic field sensing elements; and a gain equalization circuit having inputs coupled to outputs of the plurality of magnetic field sensing elements and a plurality of outputs, the gain equalization circuit configured to: extract a reference signal and an external signal from each of the plurality of magnetic field sensing element output signals, to measure a gain of each of the plurality of reference signals; select a plurality of gain adjustment values such that a ratio of the measured gains multiplied by the corresponding ones of the gain adjustment values equals the predetermined ratio of gains between the two or more of the magnetic field sensing elements, and apply the plurality of gain adjustment values to scale corresponding ones of the external signals. a plurality of magnetic field sensing elements; a coil driver configured to generate a coil drive signal; a coil structure coupled to the coil driver and configured to generate a reference magnetic field on each of the plurality of magnetic field sensing elements in response to the coil drive signal, wherein each of the plurality of magnetic field sensing elements is configured to generate an output signal responsive to the respective reference magnetic field and to external magnetic fields; a memory configured to store reference gains associated with the plurality of magnetic field sensing elements, wherein the reference gains include a predetermined ratio of gains between two or more of the magnetic field sensing elements; and a gain equalization circuit having inputs coupled to outputs of the plurality of magnetic field sensing elements and a plurality of outputs, the gain equalization circuit configured to: extract a reference signal and an external signal from each of the plurality of magnetic field sensing element output signals, to measure a gain of each of the plurality of reference signals; select a plurality of gain adjustment values such that a ratio of the measured gains multiplied by the corresponding ones of the gain adjustment values equals the predetermined ratio of gains between the two or more of the magnetic field sensing elements, and apply the plurality of gain adjustment values to scale corresponding ones of the external signals. extract a reference signal and an external signal from each of the plurality of magnetic field sensing element output signals, to measure a gain of each of the plurality of reference signals; select a plurality of gain adjustment values such that a ratio of the measured gains multiplied by the corresponding ones of the gain adjustment values equals the predetermined ratio of gains between the two or more of the magnetic field sensing elements, and apply the plurality of gain adjustment values to scale corresponding ones of the external signals.