We calculate the full set of the two-loop master integrals for heavy-to-light form factors of two different massive fermions for arbitrary momentum transfer in NNLO QCD or QED corrections. These integrals allow to determine the two-loop QCD or QED corrections to the amplitudes for heavy-to-light form factors of two massive fermions in a full analytical way, without any approximations. The analytical results of the master integrals are derived using the method of differential equations, along with a proper choosing of canonical basis for the master integrals. All the results of master integrals are expressed in terms of Goncharov polylogarithms.