Abstract 3D-printed blocks with drop coating could work as diffraction gratings while the layer stepping serves as the grooves of the gratings. This paper reports 3D-printed diffraction gratings coated with different resins. A collimated laser with a wavelength of 520 nm passed through the gratings and generated diffraction patterns. Optical path differences and surface profiles of the samples were measured to analyze the mechanism of the diffraction phenomenon. The as-printed samples had a grating height of about 8 µm induced by layer stepping, which could not generate clear diffraction patterns because of too large optical path difference. After being coated with different resins on the surfaces, the printed samples generated diffraction patterns. We experimentally showed that the magnitude of optical path differences became close to the wavelength of the laser and that the diffraction phenomenon was mainly caused by the difference in the refractive indices between the as-printed part and the drop-coated part. This novel method enables low-cost 3D printers to fabricate diffractive optical elements for visible light.