Let BMO and BLO denote the spaces of all locally integrable real-valued functions on Rn with bounded mean oscillation and bounded lower oscillation, respectively. It is well known that L∞(Rn)⫋BLO⫋BMO. In 1978, Garnett and Jones gave distance formulas of f∈BMO to L∞(Rn) and recently, Angrisani studied the distance of f∈BLO to L∞(Rn). In this paper, we characterize the distance from any given function f∈BMO to BLO via the Muckenhoupt weight class Ap as follows \begin{center} dist\,(f,\ BLO)\,∼inf{ξ∈(0,∞):e−ξf∈Apforsomep∈(1,∞)}. \end{center} Two equivalent representations of this distance are also established in terms of exponential form and the infimum of the constant in a variant of John--Nirenberg inequality, respectively.