Abstract We present a combined theoretical and experimental study of the dependence of resonant higher harmonics of rectangular cantilevers of an atomic force microscope (AFM) as a function of relevant parameters such as the cantilever force constant, tip radius and free oscillation amplitude as well as the stiffness of the sample's surface. The simulations reveal a universal functional dependence of the amplitude of the 6th harmonic (in resonance with the 2nd flexural mode) on these parameters, which can be expressed in terms of a gun-shaped function. This analytical expression can be regarded as a practical tool for extracting qualitative information from AFM measurements and it can be extended to any resonant harmonics. The experiments confirm the predicted dependence in the explored 3-45 N/m force constant range and 2-345 GPa sample's stiffness range. For force constants around 25 N/m, the amplitude of the 6th harmonic exhibits the largest sensitivity for ultrasharp tips (tip radius below 10 nm) and polymers (Young's modulus below 20 GPa). 88