X-ray fluorescence spectrometry enables non-destructive elemental analysis at ambient air pressure. In this article, after short description of interaction between x-rays and solid matter, mechanism of emission of x-ray fluorescence are explained, recent developments of x-ray source, x-ray optics, especially x-ray polycapillary focusing optics and x-ray detector are introduced. Total reflection x-ray fluorescence and micro x-ray fluorescence, including three dimensional x-ray fluorescence analysis, have been important methods for trace and micro analysis. The principle and applications of these two techniques will be described.