To date the magnetic radius of the proton has been determined only by means of electron-proton scattering, which is not free of controversies. Any existing atomic determinations are irrelevant because they are strongly model dependent. We consider a so-called Zemach contribution to the hyperfine interval in ordinary and muonic hydrogen and derive a self-consistent model-independent value of the magnetic radius of the proton. More accurately, we constrain not a value of the magnetic radius by itself, but its certain combination with the electric-charge radius of the proton, namely, ${R}_{E}^{2}+{R}_{M}^{2}$. The result from the ordinary hydrogen is found to be ${R}_{E}^{2}+{R}_{M}^{2}=1.35(12)\text{ }\text{ }{\mathrm{fm}}^{2}$, while the derived muonic value is $1.49(18)\text{ }\text{ }{\mathrm{fm}}^{2}$. That allows us to constrain the value of the magnetic radius of proton ${R}_{M}=0.78(8)\text{ }\text{ }\mathrm{fm}$ at the 10% level.