We investigate the binding of ammonia on intrinsic and substitutionally doped semiconducting single-walled carbon nanotubes (SWCNTs) on the side walls using density functional calculations. Ammonia is found to be weakly physisorbed on intrinsic semiconducting nanotubes while on substitutional doping with boron its affinity is enhanced considerably reflected with increase in binding energies and charge transfer. This is attributed to the strong chemical interaction between electron rich nitrogen of ammonia and electron deficient boron of the doped SWCNT. On doping, the density of states are changed compared to the intrinsic case and additional levels are formed near the Fermi level leading to overlap of levels with that of ammonia indicating charge transfer. The doped SWCNTs thus are expected to be a potential candidate for detecting ammonia. © 2014 Wiley Periodicals, Inc.