A thorough self-similarity analysis is presented to investigate the properties of self-similarity for the outer layer of compressible turbulent boundary layers. The results are validated using the compressible and quasi-incompressible direct numerical simulation (DNS) data shown and discussed in the first part of this study; see Wenzel et al. (J. Fluid Mech., vol. 880, 2019, pp. 239–283). The analysis is carried out for a general set of characteristic scales, and conditions are derived which have to be fulfilled by these sets in case of self-similarity. To evaluate the main findings derived, four sets of characteristic scales are proposed and tested. These represent compressible extensions of the incompressible edge scaling, friction scaling, Zagarola–Smits scaling and a newly defined Rotta–Clauser scaling. Their scaling success is assessed by checking the collapse of flow-field profiles extracted at various streamwise positions, being normalized by the respective scales. For a good set of scales, most conditions derived in the analysis are fulfilled. As suggested by the data investigated, approximate self-similarity can be achieved for the mean-flow distributions of the velocity, mass flux and total enthalpy and the turbulent terms. Self-similarity thus can be stated to be achievable to a very high degree in the compressible regime. Revealed by the analysis and confirmed by the DNS data, this state is predicted by the compressible pressure-gradient boundary-layer growth parameter $\unicode[STIX]{x1D6EC}_{c}$, which is similar to the incompressible one found by related incompressible studies. Using appropriate adaption, $\unicode[STIX]{x1D6EC}_{c}$ values become comparable for compressible and incompressible pressure-gradient cases with similar wall-normal shear-stress distributions. The Rotta–Clauser parameter in its traditional form $\unicode[STIX]{x1D6FD}_{K}=(\unicode[STIX]{x1D6FF}_{K}^{\ast }/\bar{\unicode[STIX]{x1D70F}}_{w})(\text{d}p_{e}/\text{d}x)$ with the kinematic (incompressible) displacement thickness $\unicode[STIX]{x1D6FF}_{K}^{\ast }$ is shown to be a valid parameter of the form $\unicode[STIX]{x1D6EC}_{c}$ and hence still is a good indicator for equilibrium flow in the compressible regime at the finite Reynolds numbers considered. Furthermore, the analysis reveals that the often neglected derivative of the length scale, $\text{d}L_{0}/\text{d}x$, can be incorporated, which was found to have an important influence on the scaling success of common ‘low-Reynolds-number’ DNS data; this holds for both incompressible and compressible flow. Especially for the scaling of the $\bar{\unicode[STIX]{x1D70C}}\widetilde{u^{\prime \prime }v^{\prime \prime }}$ stress and thus also the wall shear stress $\bar{\unicode[STIX]{x1D70F}}_{w}$, the inclusion of $\text{d}L_{0}/\text{d}x$ leads to palpable improvements.