  We derive a formula which applies to conformal field theories on a spatial
torus and gives the asymptotic density of states solely in terms of the vacuum
energy on a parallel plate geometry. The formula follows immediately from
global scale and Lorentz invariance, but to our knowledge has not previously
been made explicit. It can also be understood from the fact that $\log Z$ on
$\mathbb{T}^2\times \mathbb{R}^{d-1}$ transforms as the absolute value of a
non-holomorphic modular form of weight $d-1$, which we show. The results are
extended to theories which violate Lorentz invariance and hyperscaling but
maintain a scaling symmetry. The formula is checked for the cases of a free
scalar, free Maxwell gauge field, and free $\mathcal{N}=4$ super Yang-Mills.
The case of a Maxwell gauge field gives Casimir's original calculation of the
electromagnetic force between parallel plates in terms of the entropy of a
photon gas.
