The transformation electromagnetics is applied to the modeling of electromagnetic scattering from periodic structures in conjunction with the finite element method with periodic boundary conditions. In a unit cell of periodic structure, a uniform mesh is used over a flat surface and the arbitrary periodic surface is modeled by a coordinate transformation. The major advantage of this approach is that arbitrary geometries can be handled by using a single and simple mesh. Therefore, repeated computations (such as in Monte Carlo simulations or optimization methods) corresponding to different geometries can be performed easily. Some numerical examples are demonstrated involving singly periodic structures.