We report on the calculation of the photon-energy spectrum in the inclusive
radiative decay $B\to X_s\gamma$ induced by the electromagnetic dipole
operator $O_7$ through next-to-next-to-next-to-leading order (N$^3$LO) in
QCD. We obtain the complete light-fermion contributions, the terms with two
closed massive-fermion loops, and the leading-colour contribution to the
remaining bosonic part. The real-emission corrections are extracted from the
imaginary part of the forward-scattering amplitude $b\gamma\to b\gamma$ and
combined with the virtual contributions available as
three-loop heavy-to-light form factors. We discuss the
photon-energy spectrum, the rate with and without a lower photon-energy cut,
and the perturbative behaviour in the pole, kinetic, and MSR mass schemes.
The use of a short-distance bottom-quark mass substantially improves the
convergence of the integrated rate.

