We establish an explicit formula for the general solution of the Benjamin–Ono equation on the torus and on the line.