We introduce a framework for quantifying random matrix behavior of 2d CFTs and AdS3 quantum gravity. We present a 2d CFT trace formula, precisely analogous to the Gutzwiller trace formula for chaotic quantum systems, which originates from the SL(2, ℤ) spectral decomposition of the Virasoro primary density of states. An analogy to Berry’s diagonal approximation allows us to extract spectral statistics of individual 2d CFTs by coarse-graining, and to identify signatures of chaos and random matrix universality. This leads to a necessary and sufficient condition for a 2d CFT to display a linear ramp in its coarse-grained spectral form factor.Turning to gravity, AdS3 torus wormholes are cleanly interpreted as diagonal projections of squared partition functions of microscopic 2d CFTs. The projection makes use of Hecke operators. The Cotler-Jensen wormhole of AdS3 pure gravity is shown to be extremal among wormhole amplitudes: it is the minimal completion of the random matrix theory correlator compatible with Virasoro symmetry and SL(2, ℤ)-invariance. We call this MaxRMT: the maximal realization of random matrix universality consistent with the necessary symmetries. Completeness of the SL(2, ℤ) spectral decomposition as a trace formula allows us to factorize the Cotler-Jensen wormhole, extracting the microscopic object ZRMT(τ) from the coarse-grained product. This captures details of the spectrum of BTZ black hole microstates. ZRMT(τ) may be interpreted as an AdS3 half-wormhole. We discuss its implications for the dual CFT and modular bootstrap at large central charge.