Water containing suspended nanobubbles is utilized in various applications. The observed lifetime of suspended nanobubbles is several weeks, whereas, according to the classical theory of bubble stability, a nanosized bubble should dissolve within microseconds. Explanations for the longevity of nanosized bubbles have been proposed but none of them has gained general acceptance. In this study, we derive an explanation for the existence of metastable nanobubbles solely from the thermodynamic principles. According to our analysis, the dissolution of nanosized aqueous bulk bubbles is nonspontaneous below 180 nm diameter due to the energy requirement of gas dissolution. Hydrophobic surfaces have a further stabilizing effect, and the dissolution becomes nonspontaneous in surface nanobubbles having a diameter below 600 nm.