In the view formalized for acids and bases at the turn of the century,
an acid was any substance that dissociated to give H+
ions in aqueous solution, and a base was any substance that dissociated
to give OH- ions.This definition (proposed by Arrhenius)
was fine for potassium hydroxide, but where was the hydroxide ion
in ammonia, NH4+?
Ammonia releases hydroxide ions when it dissolves, but only because
the ammonia steals a proton from a water molecule:
One could talk about "ammonium hydroxide," NH4OH,
but there is no evidence that the compound exists.
A better definition of acids and bases in aqueous solutions is:
An acid is any substance that, when added to an aqueous solution,
increases the hydrogen ion concentration; a base is any substance
that, when added to an aqueous solution, decreases the hydrogen
ion concentration and increases the hydroxide ion concentration.
Since [H+] and [OH-] are linked by the water
dissociation equilibrium, when one is increased, the other must
decrease. By this definition, both NaOH and NH3 are bases
because they increase the hydroxide ion concentration, [OH-].
In the case of NaOH, the hydroxide ions come from the crystal lattice
of the solid, and in the case of NH3 they come from dissociated
water molecules whose protons have combined with NH3
to form, NH4+. The overall effect is the same.