The partition function of gravitons with Casimir-type boundary conditions is worked out. The simplest box that allows one to achieve full analytical control consists of a slab geometry with two infinite parallel planes separated by a distance d. In this setting, linearized gravity, like electromagnetism, is equivalent to two free massless scalar fields, one with Dirichlet and one with Neumann boundary conditions, which in turn may be combined into a single massless scalar with periodic boundary conditions on an interval of length 2d. When turning on a chemical potential for suitably adapted spin angular momentum, the partition function is modular covariant and expressed in terms of an Eisenstein series. It coincides with that for photons. At high temperature, the result provides in closed form all subleading finite-size corrections to the standard (gravitational) black body result. More interesting is the low-temperature/small distance expansion where the leading contribution to the partition function is linear in inverse temperature and given in terms of the Casimir energy of the system, whereas the leading contribution to the entropy is proportional to the area and originates from gravitons propagating parallel to the plates.