Chemical sensing using optical diffraction from an array of microcantilevers is demonstrated. Properly fashioned arrays of micromachined silicon-nitride cantilevers containing embedded deformable diffraction gratings are functionalized with chemically selective coatings. Adsorption of specific molecules on the cantilever leads to bending, which changes the diffraction pattern of a laser beam reflecting off the array. Quantitative chemical information can be obtained by monitoring the displacement of diffraction peaks as a function of analyte exposure.