The lithography is a basic microelectronic process which determines properties of fabricated device. The resolution of optical lithography applied nowadays is insufficient for creating high resolution patterns such as gate electrode in transistors. The scaling ability is the major motivation for undertaking experiments to elaborate high resolution lithography techniques. The atomic force microscope (AFM) is commonly used as tool for creation patterns in sub-micrometers resolution. In this paper, the results of simulations of electromagnetic field behavior during passing the gap with a size smaller than the wavelength of the optical lithography light source are presented. Also results of the nanoscratching lithography prepared for various parameters of force that are applied to the tip are summarized.