A separating funnel is used to separate two liquids that do not mix. When diethyl ether and water are put into it, the ether, which is less dense than water, forms the upper layer, and the water forms the lower layer.
Most aromatic compounds dissolve well in ether but only a little in water. Salts, on the other hand, dissolve in water but hardly at all in ether.
The funnel is shaken, with the tap opened now and then to let out the ether vapour, and then left to stand. The lower layer is run out through the tap, and the upper layer is poured out from the top.
Suppose that aniline, benzoic acid, phenol and nitrobenzene are dissolved together in ether. When dilute hydrochloric acid is added and the funnel is shaken, aniline, which is a base, forms a salt, anilinium chloride, and moves into the water layer.
\mathrm{C_6H_5NH_2} + \mathrm{HCl} \longrightarrow \mathrm{C_6H_5NH_3Cl}
Benzoic acid, phenol and nitrobenzene do not react with hydrochloric acid, so they stay in the ether layer. When sodium hydroxide solution is added to the water layer that has been run off, aniline is set free again.
Benzoic acid, \mathrm{C_6H_5COOH}, is a carboxylic acid in which a carboxy group is bonded to a benzene ring. When sodium hydrogencarbonate solution is added to the ether layer, benzoic acid, which is a stronger acid than carbonic acid, gives off carbon dioxide, forms sodium benzoate and moves into the water layer.
\mathrm{C_6H_5COOH} + \mathrm{NaHCO_3} \longrightarrow \mathrm{C_6H_5COONa} + \mathrm{H_2O} + \mathrm{CO_2}
Phenol, which is a weaker acid than carbonic acid, does not react and stays in the ether layer. When hydrochloric acid is added to the water layer, benzoic acid is set free again.
When sodium hydroxide solution is then added to the ether layer, phenol forms sodium phenoxide and moves into the water layer.
\mathrm{C_6H_5OH} + \mathrm{NaOH} \longrightarrow \mathrm{C_6H_5ONa} + \mathrm{H_2O}
Nitrobenzene, which is neither an acid nor a base, stays in the ether layer, and it is obtained by evaporating the ether. When carbon dioxide is blown into the water layer, phenol is set free again.
The order in which the solutions are added matters. If sodium hydroxide solution were added before sodium hydrogencarbonate solution, benzoic acid and phenol would both move into the water layer together.
In this way, compounds can be separated by using the differences in their strength as acids and bases, turning them one at a time into salts that dissolve in water.