In this paper, we are concerned with the following n-Laplacian mean field equation \( \left\{ {\begin{array}{*{20}{l}} { - \Delta _n u = \lambda e^u} & \textrm{in} \ \ \Omega , \\ {\ \ \ \ u = 0} & \ \textrm{on}\ \partial \Omega , \end{array}} \right. \) where \(\Omega \) is a smooth bounded domain of \(\mathbb {R}^n \ (n\ge 2)\) and \(- \Delta _n u =-\textrm{div}(|\nabla u|^{n-2}\nabla u)\) . We first establish the quantization property of solutions to the above n-Laplacian mean field equation. As an application, combining the Pohozaev identity and the capacity estimate, we obtain the sharp constant C(n) of the Moser–Onofri inequality in the n-dimensional unit ball \(B^n:=B^n(0,1)\) , \( \mathop {\inf }\limits _{u \in W_0^{1,n}(B^n)}\frac{1}{ n C_n}\int _{B^n} | \nabla u|^n dx- \ln \int _{B^n} {e^u} dx\ge C(n), \) which extends the result of Caglioti in (Commun Math Phys 143:501–525, 1992) to the case of n-dimensional ball. Here \(C_n=\left( \frac{n^2}{n-1}\right) ^{n-1} \omega _{n-1}\) and \(\omega _{n-1}\) is the surface measure of \(B^n\) . For the Moser–Onofri inequality in a general bounded domain of \(\mathbb {R}^n\) , we apply the technique of n-harmonic transplantation to give the optimal concentration level of the Moser–Onofri inequality and obtain the criterion for the existence and non-existence of extremals for the Moser–Onofri inequality.