why in esterification alcohol act as acid and carboxylic acid act as base ?
Strong acids protonate the carbon with -OH group (acid), which makes the oxygen positively charged, so that it can easily receive the double bond electrons when the alcohol attacks the carbonyl carbon (base) . This enables ester synthesis and hydrolysis. The reaction is an equilibrium between the ester and its cleavage to carboxylic acid and alcohol. On the contrary, strong bases deprotonate the attacking alcohol or amine, which also promotes the reaction. However, bases also deprotonate the acid, which is irreversible. Therefore, in a strongly basic, aqueous environment, esters only hydrolyze.