In this paper, we report a detailed investigation of the effect of varying concentrations of sodium dodecyl sulfate (SDS) on the rate of polymerization of aniline. Quantitative analysis of the data is done in order to propose a probable mechanism for the growth of polyaniline (PANI) in presence of SDS (SDS–PANI). The SDS–PANI films were characterized by cyclic voltammetry, electrochemical quartz crystal microbalance (EQCM), in situ conductance, in situ UV–vis spectroscopy and scanning electron microscopy (SEM) and were contrasted with polyaniline prepared under identical conditions in the absence of SDS. The polymerization rate was found to decrease initially with increase in concentration of SDS; it passes through a minimum at 1.5 mM and then increases rapidly on further increasing the SDS concentration. EQCM studies showed that the polymerizing species is a charge transfer complex formed between SDS and aniline. Leaching out of SDS was observed during redox cycling of the SDS–PANI films, which results in the formation of a porous polymer film allowing more inclusion of ions. This was further confirmed by observing a higher transport rate of urea across SDS–PANI coated membrane. These porous polyaniline films were then used as transducer for sensing urea.