Global population growth and urbanization necessitate countless more buildings in this century, causing an unprecedented increase in energy consumption, greenhouse gas emissions, waste generation and resource use. It is imperative to achieve maximal efficiency in buildings quickly. The building envelope is a key element to address environmental concerns, as it is responsible for thermal transfers to the outdoors, causing energy demand and carbon emissions. It also requires cladding, thus consuming a significant amount of finite resources. This paper investigates the relationship between surface area and indoor space to unravel the sustainability of building forms. Firstly, we demonstrate what the optimal form is. Secondly, as a single definite form is of little use in practice, we develop a scale-independent metric to measure the degree of optimality of building forms and show its practical use. This newly developed metric can significantly help in early design stages, by quantifying how much a building form deviates from optimality and identifying the domain of alternative geometries to bring us closer to it. This compactness measure also represents a theoretical basis for further research, to explore how optimality changes when additional parameters are factored in. It therefore contributes to both theory and practice to support global efforts towards sustainable built environments.