In 1992 A. Zhedanov introduced the Askey-Wilson algebra AW=AW(3) and used it to describe the Askey-Wilson polynomials. In this paper we introduce a central extension $\Delta$ of AW, obtained from AW by reinterpreting certain parameters as central elements in the algebra. We call $\Delta$ the {\it universal Askey-Wilson algebra}. We give a faithful action of the modular group ${\rm {PSL}}_2({\mathbb Z})$ on $\Delta$ as a group of automorphisms. We give a linear basis for $\Delta$. We describe the center of $\Delta$ and the 2-sided ideal $\Delta[\Delta,\Delta]\Delta$. We discuss how $\Delta$ is related to the $q$-Onsager algebra.