Conducting polymer diffraction gratings on Au substrates have been created using microcontact printing of C18-alkanethiols, followed by electropolymerization of either poly(aniline) (PANI) or poly(3,4-ethylenedioxythiophene) (PEDOT). Soft-polymer replicas of simple diffraction grating masters (1200 lines/mm) were used to define the alkanethiol template for polymer growth. Growth of PANI and PEDOT diffraction gratings was followed in real time, through in situ tapping-mode atomic force microscopy, and by monitoring diffraction efficiency (DE) as a function of grating depth. DE increased as grating depth increased, up to a limiting efficiency (13-26%, with white light illumination), defined by the combined optical properties of the grating and the Au substrate, and ultimately limited by the loss of resolution due to coalescence of the polymer films. Grating efficiency is strongly dependent upon the grating depth and the refractive index contrast between the grating material and the surrounding solutions. Both PEDOT and PANI gratings show refractive index changes as a function of applied potential, consistent with changes in refractive index brought about by the doping/dedoping of the conducting polymer. The DE of PANI gratings are strongly dependent on the pH of the superstrate solution; the maximum sensitivity (DeltaDE/DeltapH) is achieved with PANI gratings held at +0.4 V versus Ag/AgCl, where the redox chemistry is dominated by the acid-base equilibrium between the protonated (emeraldine salt) and deprotonated (emeraldine base) forms of PANI. Simulations of DE were conducted for various combinations of conducting polymer refractive index and grating depth, to compute sensitivity parameters, which are maximized when the grating depth is ca. 50% of its maximum obtainable depth.