We apply the theory of harmonic analysis on the fundamental domain of $SL(2,mathbb{Z})$ to partition functions of two-dimensional conformal field theories. We decompose the partition function of $c$ free bosons on a Narain lattice into eigenfunctions of the Laplacian of worldsheet moduli space $mathbb H/SL(2,mathbb Z)$, and of target space moduli space $O(c,c;mathbb Z)backslash O(c,c;mathbb R)/O(c)times O(c)$. This decomposition manifests certain properties of Narain theories and ensemble averages thereof. We extend the application of spectral theory to partition functions of general two-dimensional conformal field theories, and explore its meaning in connection to AdS$_3$ gravity. An implication of harmonic analysis is that the local operator spectrum is fully determined by a certain subset of degeneracies.