A relativistic wave equation for bound states of two fermions with arbitrary masses which are exposed to a magnetic field is derived from quantum electrodynamics. The interaction kernels are based upon the generalized invariant M -matrices for inter-fermion and fermion-field interactions. As an application we calculate the energy corrections in a weak homogeneous B field to obtain the Zeeman splitting of the hyperfine structure (HFS) and g-factors in the lowest order (i.e. to O (α 4 )). Landé g-factors are presented for several of the first excited states of hydrogen, muonium, and muonic-hydrogen.