Fiber gratings can be viewed as a periodic high and low refractive index multilayer thin film stack. The total reflection coefficient of this structure is then obtained through a recursion formula, which is derived by using electromagnetic field theory. Bragg matched and detuned uniform gratings as well as non uniform gratings have been analyzed by using this method. The results have been compared with that by using coupled mode theory, Rouard's method and fundamental matrix method, and the accuracy of these methods have been checked.