We study the thermoelectric transport of the graphene p−n junction under the perpendicular magnetic field. The Seebeck coefficient Sc, the thermoelectrical figure of merit ZT and the power-generation efficiency η are obtained by the Landauer–Büttiker formula combined with the nonequilibrium Green’s function method. Compared to the perfect graphene system, the graphene p−n junction has a zero-transport coefficient plateau (or the transport gap). The sudden jump of the transmission coefficient near the transport gap edge lead to very larger peaks of the Sc and ZT. Especially in the presence of a magnetic field, the perpendicular magnetic field applied to the p−n junction strongly suppresses the conductance, and enhances the Seebeck coefficient Sc and increases the ZT. Moreover, it is found that the Seebeck coefficient Sc and ZT are strongly dependent on the applied perpendicular magnetic field ϕ, the potential drop in the center region of the p−n junction and the center region length M of the p−n junction. This means that the thermoelectric performance of the graphene p−n junction can be easily regulated by changing the magnetic field and the center region lengths of the p−n junction. Finally, the power-generation efficiency η of the graphene p−n junction as a power generator is calculated. It is found that when the Carnot power-generation efficiency is greater than 30%, ZTM can still be greater than 10. The large ZTM value also maintains a high power-generation efficiency, which indicates that the graphene p−n junction has potential applications as thermoelectric devices.