The pH sensitivity of electrically conducting polyaniline (PANI) and its derivatives poly(o-methylaniline) (PoMeANI), poly(o-ethylaniline) (PoEtANI), poly(o-propylaniline) (PoPrANI) and poly(N-methylaniline) (PNMeANI) have been studied with potentiometry and UV–vis spectroscopy. The electropolymerisation of PANI was carried out either in hydrochloric acid (HCl), methanesulphonic acid (MSA), benzenesulphonic acid (BSA) or dodecylbenzenesulphonic acid (DBSA). It is shown that the pH sensitivity of PANI and its derivatives depend on the substituent and the size of the acid anion that is used in the electropolymerisation. PANI membranes prepared in HCl show a selective and slightly super-Nernstian potentiometric pH response (62.4±0.9 mV per pH; pH 2–9), while PNMeANI, PoPrANI and PANI prepared with DBSA have a strongly suppressed pH response. The hysteresis effect observed in the UV–vis measurements for all membrane types studied restrict the use of PANI-based optical pH sensors to the pH range of only 5–8.