Frequency-modulation atomic force microscopy (FMAFM) has proven to be a powerful method for imaging surfaces with true atomic resolution. However, the tip-sample forces are not directly accessible by FMAFM. Here, an algorithm to recover the tip-sample forces from the frequency shift curve is introduced and demonstrated with experimental data. Also, an intuititive connection between frequency shift Deltaf and tip-sample force gradient k(ts) that simplifies the calculation of FMAFM images is established: Deltaf is a convolution of k(ts) with a semispherical weight function. (C) 2001 American Institute of Physics.