We present the calculation of the master integrals needed for the two-loop QCD×EW corrections to q +q → l − + l + and q +q → l − + ν , for massless external particles. We treat the W and Z bosons as degenerate in mass. We identify three types of diagrams, according to the presence of massive internal lines: the no-mass type, the onemass type, and the two-mass type, where all massive propagators, when occurring, contain the same mass value. We find a basis of 49 master integrals and evaluate them with the method of the differential equations. The Magnus exponential is employed to choose a set of master integrals that obeys a canonical system of differential equations. Boundary conditions are found either by matching the solutions onto simpler integrals in special kinematic configurations, or by requiring the regularity of the solution at pseudothresholds. The canonical master integrals are finally given as Taylor series around d = 4 spacetime dimensions, up to order four, with coefficients given in terms of iterated integrals, respectively up to weight four.