Hydrogel diffraction gratings containing crown-ether functional groups were developed as a new sensing strategy for heavy metal ion detection. The gratings were fabricated by soft-lithographic duplication of photoinduced surface-relief-gratings (SRGs) on azo polymer masters to the hydrogel surfaces. In the fabrication, the elastomer stamps were obtained by replica-molding against the SRG-bearing masters. The hydrogel gratings were fabricated by micro-contact printing with the stamps and in situ photo-polymerization of acrylamide, crown ether monomer, crosslinker and photo-initiator in a mixed DMSO/H2O solution. The quantitative detection of Pb2+ ions was achieved by monitoring the variation of diffraction efficiency of the gratings when exposed to Pb(NO3)2 solutions with different ion concentrations. The diffraction efficiency (DE) variation was triggered by the binding of Pb2+ ions with crown-ether rings and increasing amount of mobile counter-ions in the hydrogel due to Donnan potential. The mobile ions in the hydrogel established an excess osmotic pressure, which caused the grating to swell and DE variation. The saturated diffraction efficiency (DE/DE0) was observed to be linearly correlated with the Pb(NO3)2 concentration in the testing range. The gratings developed in this study show excellent sensitivity to the Pb2+ ion with the fast response and high selectivity to the analytes.