We present a theory of the atomic resolution in scanning tunneling microscopy(STM) in terms of localized surface states on the tip. The tunneling matrix elements arising from these tip states are evaluated with the d e r i v a t i v e r u l e. For example, a p z surface state on the tip generates a tunneling matrix element proportional to [∂ψ/∂z] at the nucleus of the apex atom, and a d 3z 2−r 2 tip state generates a tunneling matrix element proportional to [3∂2ψ/∂z 2−κ2ψ], (ψ is the sample wave function, κ is the decay constant of surface wave function, κ=(2m e φ)1/2/ℏ ). To obtain analytic results of theoretical STM images, we further developed a simple independent‐orbital model to describe the wave functions of the sample surface. With this model, we present qualitative and quantitative explanations of the observed atomic resolution on metals and semiconductors, the spontaneous switching of instrument resolution during imaging, and various tip‐sharpening procedures.