A process in which a hydrogen atom in an organic compound is re­placed by an acyl group (R-CO, where R = an organic group). The reaction in­volves substitution by a nucleophile (electron donor) at the electrophilic carbonyl group (C=O) of a carboxylic acid derivative. The substitution usually proceeds by an addition-elimination sequence. Two common reagents, with the general formula RCOX, that bring about acylation are acid halides (X = Cl, Br) and anhydrides (X = OCOR). There are also other acylating reagents. The carboxylic acid (X = OH) itself can function as an acylating agent when it is protonated by a strong acid catalyst as in the direct esterification of an alcohol. Typical nucleophiles in the acylation reaction are alcohols (ROH) or phenols (ArOH), both of which give rise to esters, and ammonia or amines (RNH₂), which give amides.