The atomistic simulation of nanoidentation has become a powerful method to probe the mechanical behaviour and properties of small volumes of materials. It is crucial to calculate the projected contact area (PCA) accurately in order to obtain a reliable value of nanoindentation hardness. In this work, atomistic simulations of nanoindentation were performed on the Cu(111) and Ag(111) surfaces, and a new compensational boundary method is proposed to calculate the PCA. Compared with other available methods, this method provides a clear physical implication, and works well independently of the contact depth and the deformation behaviour of the material. It is also concluded that the widely-used experimental Oliver–Pharr (O–P) method significantly underestimates the PCA in atomistic simulations, and does not work for shallow nanoindentation at the nanoscale