A series of esters were prepared by electrochemical synthesis of carboxylic acids with alcohols. This protocol can be carried out at room temperature without inert atmosphere, strong acids or metal catalysts, etc. The esterification reaction processes in an undivided electrolytic cell with constant current mode and the esterification products are generated in good yields. Compared with esterification promoted by organic reagents, this protocol avoids the byproducts which have to be separated by column chromatography and successful for tertiary alcohol which is generally difficult to undergo esterification directly, providing a new access to the esterification of carboxylic acids and alcohols.