Water is amphoteric: it has the ability to act as either an acid or a base in chemical reactions. According to the Brønsted-Lowry definition, an acid is a proton () donor and a base is a proton acceptor. When reacting with a stronger acid, water acts as a base; when reacting with a stronger base, it acts as an acid. For instance, water receives an  ion from HCl when hydrochloric acid is formed:
In the reaction with ammonia, , water donates a  ion, and is thus acting as an acid:
Because the oxygen atom in water has two lone pairs, water often acts as a Lewis base, or electron-pair donor, in reactions with Lewis acids, although it can also react with Lewis bases, forming hydrogen bonds between the electron pair donors and the hydrogen atoms of water. HSAB theory describes water as both a weak hard acid and a weak hard base, meaning that it reacts preferentially with other hard species:
When a salt of a weak acid or of a weak base is dissolved in water, water can partially hydrolyze the salt, producing the corresponding base or acid, which gives aqueous solutions of soap and baking soda their basic pH:
: +   NaOH +