We studied the spin–orbit torque in heavy metal/ferromagnetic metal bilayers using the magneto-optical Kerr effect. A double-modulation technique is developed to separate signals from the spin–orbit torque and Joule heating. At a current density of ∼1 × 1010 A/m2, we observe optical signals that scale linearly and quadratically with the current density, both in similar magnitude. The spin–orbit torque estimated using this technique is consistent with that evaluated using spin-transport measurements. We find that changes in the refractive index of the film with temperature are the main source of the heating-induced signal.