We investigate the atomic-scale details of atomic force microscopy through a quasistatic molecular dynamics simulation together with a density-functional-based tight-binding method. The changes in the AFM tip shape, the size of the tip-sample contact area, as well as the microscopic hardness and Young's moduli of silicon ͕111͖,͕110͖,͕100͖ surfaces are studied. Furthermore, the effects of hydrogen termination of the surface and of subsurface vacancies on hardness and Young's modulus are discussed.