An optical element includes a substrate (2) and a light-shielding film (1) on a part of the periphery of the substrate. The light-shielding film contains a compound (14) having an epoxy group, a coloring agent (15), inorganic particles (12) having a refractive index of 2.2 or more, and silica particles (13). The average concentration of the inorganic particles in an interface region having a thickness of 15 nm from the interface (7) between the substrate and the light-shielding film is 1.1 to 1.5 times as high as the average concentration of the inorganic particles in the light-shielding film.