Molecularly imprinted polyaniline (PANI) film (∼100 nm thick) has been electrochemically fabricated onto indium–tin–oxide (ITO) coated glass plate using ascorbic acid (AA) as template molecule. Fourier transform infra-red spectroscopy, scanning electron microscopy, cyclic voltammetry and differential pulse voltammetry (DPV) studies indicate the presence of AA in PANI matrix, which also acts as a dopant for PANI. Further, the AA selective molecularly imprinted PANI electrode (AA-MI-PANI/ITO) has been developed via over-oxidation of AA doped PANI electrode which leads to the removal of AA moieties from PANI film. The response studies using DPV technique have revealed that this molecularly imprinted AA-MI-PANI/ITO electrode can detect AA in the range of 0.05–0.4 mM with detection limit of 0.018 mM and sensitivity of 1.2 × 10−5 AmM−1. Interestingly, this AA-MI-PANI/ITO electrode shows excellent reusability, selectivity and stability. Copyright © 2011 John Wiley & Sons, Ltd.