The computation of a certain class of four-point functions of heavily charged BPS operators boils down to the computation of a special form factor — the octagon. In this paper, which is an extended version of the short note [1], we derive a non-perturbative formula for the square of the octagon as the determinant of a semi-infinite skew-symmetric matrix. We show that perturbatively in the weak coupling limit the octagon is given by a determinant constructed from the polylogarithms evaluating ladder Feynman graphs. We also give a simple operator representation of the octagon in terms of a vacuum expectation value of massless free bosons or fermions living in the rapidity plane.