Cell mechanics plays an important role in cellular physiological and pathological processes. During the formation and progression of tumors, the alterations in the mechanics of cancerous cells and tumor micro-environment promote the growth and migration of cancerous cells. Hence, investigating cell mechanics is of crucial significance in understanding the underlying mechanisms regulating life activities and diseases. The advent of atomic force microscopy (AFM) provides a powerful tool for detecting the mechanical properties of single cells. Compared with other single-cell mechanical analysis techniques, the advantage of AFM is that AFM is able to simultaneously obtain the topography and mechanics of cells, which is particularly useful for investigating the correlation between cell structures and cell mechanics. The biomedical applications of AFM in single-cell mechanics provide considerable novel insights into how cell and tissue mechanics affect tumor development and metastasis, contributing much to the communities of biomechanics and biophysics. However, current AFM single-cell mechanical experiments are commonly performed on measuring the elastic properties of cells and studies about the viscoelastic properties of cells are still scarce. In this work, AFM was utilized to measure and analyze the viscoelastic properties of cells. First, the detailed procedure of detecting the viscoelasticity of cells based on AFM indentation technique was established. AFM probe was controlled to perform approach-dwell-retract movement on cells in the vertical direction. During the approach-dwell-retract process, the deflection of AFM cantilever versus time was recorded, which yielded the force-time (F-T) curves. The original F-T curves were then normalized and fitted by two-order Maxwell model, which gave two cellular relaxation times (the first relaxation time τ 1 and the second relaxation time τ 2). The fitting results showed that the theoretical curve matched the experimental relaxation curve well, indicating that the two-order Maxwell model was suited for characterizing the relaxation behaviors of cells. Second, the established procedure was used to measure the relaxation time of six different types of cells, including mammalian adherent cells, mammalian suspended cells, normal cells, cancerous cells, cell lines cultured in vitro and primary cells prepared from bone marrow and peripheral blood of healthy volunteers. The fitting curves were consistent with the experimental relaxation curves for all of the six types of cells used here, indicating the effectiveness of the presented method for detecting the viscoelastic properties of cells. Besides, the results showed the various cellular relaxation times for the different types of cells. The statistical results showed that the first cellular relaxation times were in the range 0.01−0.03 s, which might correspond to the behaviors of cytoplasm. The second cellular relaxation time was in the range 0.2−0.4 s, which might correspond to the behaviors of the cytoskeleton. Finally, regression analysis was performed on the measured cellular relaxation times, showing the linear relationship between the first cellular relaxation time τ 1 and the second cellular relaxation time τ 2, and the regression coefficients were variable for different types of cells. The research improves our understanding of cellular viscoelasticity and also provides a novel idea to measure the viscoelastic properties of cells, which will have potential impacts on cell mechanics and biomedicine.