We present a general method to derive the magnetic field dependence of the surface resistance of superconductors from the Q-curves obtained during the cryogenic tests of cavities. The results are applied to coaxial half-wave cavities, TM-like elliptical accelerating cavities, and cavities of more complicated geometries.