The less basic character of aniline can be explained on the basis of resonance shown by aniline.

Due to resonance, the nitrogen atom of amino group in aniline acquires a positive charge, hence, lone pair of electrons is less available for protonation as compared to that of ammonia. Aniline is resonance stabilized by five resonance structures. On the other hand, aniline in aqueous medium, accepts a proton does not have lone pair of electrons on nitrogen to produce a very low concentration of anilium ion and anilium ion shows only two resonance structures and therefore less stabilized than anline.

Thus, aniline is more stable than anilium ion. Hence aniline accepts proton less readily or less basic in nature than ammonia.