We obtain estimates for large and moderate deviations for the capacity of the range of a random walk on $mathbb{Z}^d$, in dimension $dge 5$, both in the upward and downward directions. The results are analogous to those we obtained for the volume of the range in two companion papers [AS17, AS19]. Interestingly, the main steps of the strategy we developed for the latter apply in this seemingly different setting, yet the details of the analysis are different