  We use the hexagon function bootstrap to compute the ratio function which
characterizes the next-to-maximally-helicity-violating (NMHV) six-point
amplitude in planar $\mathcal{N} = 4$ super-Yang-Mills theory at four loops. A
powerful constraint comes from dual superconformal invariance, in the form of a
$\bar{Q}$ differential equation, which heavily constrains the first derivatives
of the transcendental functions entering the ratio function. At four loops, it
leaves only a 34-parameter space of functions. Constraints from the collinear
limits, and from the multi-Regge limit at the leading-logarithmic (LL) and
next-to-leading-logarithmic (NLL) order, suffice to fix these parameters and
obtain a unique result. We test the result against multi-Regge predictions at
NNLL and N$^3$LL, and against predictions from the operator product expansion
involving one and two flux-tube excitations; all cross-checks are satisfied. We
study the analytical and numerical behavior of the parity-even and parity-odd
parts on various lines and surfaces traversing the three-dimensional space of
cross ratios. As part of this program, we characterize all irreducible hexagon
functions through weight eight in terms of their coproduct. We also provide
representations of the ratio function in particular kinematic regions in terms
of multiple polylogarithms.
