A grating element 2C has: a supporting substrate 14; a cladding layer 4 that is provided on the supporting substrate 14; an optical material layer 1 that is provided on the cladding layer 4; and a ridge-type optical waveguide 3A, which is provided in the optical material layer 1, and which has an input surface to which laser light is inputted, and an output section from which output light having a desired wavelength is outputted. At the boundary between the cladding layer 4 and the optical material layer 1, a Bragg grating 20 configured from recesses and projections is formed. The ridge-type optical waveguide 3A is provided with: an input section 3a that is provided between the input surface and the Bragg grating; and a grating section 3d that is provided with the Bragg grating. The thickness Tin of the optical material layer 1 at the input section 3a is larger than the thickness Tgr of the optical material layer at the grating section.