Abstract In this paper, we provide an alternative proof for the classical Sz. Nagy inequality in one dimension by a variational method and generalize it to higher dimensions J(h):=(∫Rd|h| dx)a611∫Rd|63h|2 dx(∫Rd|h|m+1 dx)a+1m+1≥β0, where m > 0 for d = 1, 2, for , and . The Euler–Lagrange equation for critical points of in the non-negative radial decreasing function space is given by a free boundary problem for a generalized Lane–Emden equation, which has a unique solution (denoted by h c ) and the solution determines the best constant for the above generalized Sz. Nagy inequality. The connection between the critical mass for the thin-film equation and the best constant of the Sz. Nagy inequality in one dimension was first noted by Witelski et al (2004 Eur. J. Appl. Math. 15 223–56). For the following critical thin film equation in multi-dimension ht+6366(h 63Δh)+6366(h 63hm)=0,x∈Rd, where m = 1 + 2/d, the critical mass is also given by . A finite time blow-up occurs for solutions with the initial mass larger than M c . On the other hand, if the initial mass is less than M c and a global non-negative entropy weak solution exists, then the second moment goes to infinity as or in for some subsequence . This shows that a part of the mass spreads to infinity.