 This paper proposes a novel approach for calibrating magnetometers inside cubesats before or after launch. The authors use a genetic algorithm to identify nine unknowns, including scaling factors, non-orthogonal angles, and offsets, which can cause high oscillation in the measured total magnetic field data. They then compare their results with magnetic field data similar to those of a model magnetic field, finding that the deviation is smaller. The authors also show that the answers obtained from the genetic algorithm are consistent with additional orbit data from the same satellite. This method could be used in the future to calibrate magnetometers inside cubesats before or after launch. This article was authored by Delani Chameca with Anage, Mariko Teramoto, and Mangucho.