• Random acrylic terpolymers as demulsifying agents for crude oil. • Trifunctional molecule with exceptional dehydrating and clarifying capacities. • Higher performance to dehydrate crude oils than commercial formulations. • Prediction of dehydrating efficiency as function of the crude oil properties. A novel kind of random acrylic terpolymers based on butyl acrylate (B), 2-(dimethylamino)ethyl acrylate (Ae), and 2-carboxyethyl acrylate (Ce) monomers was obtained by emulsion polymerization. Monomers’ weight ratios were varied, keeping in all cases a higher content of butyl acrylate (60, 70, 80, and 90 wt%) and controlling the number average molecular mass ( M ¯ n ) during polymerization. The random acrylic terpolymers were characterized by spectroscopic techniques; subsequently evaluated as demulsifier agents in three aged heavy crude oils of 7.55, 6.11, and 3.33 °API (apparent gravities), which form very stable water-in-oil (W/O) emulsions. The best performance for removing the emulsified water at 80 °C was obtained with terpolymers containing 90–80 wt% of the hydrophobic monomer B and small amounts of the hydrophilic monomers Ae and Ce (BAeCe-9551 and BAeCe-8111), being more efficient than two commercial demulsifiers (FDH-1 and F-46 TRETOLITE™). Moreover, the BAeCe-9551 terpolymer was evaluated in a fresh heavy crude oil of 20.2 °API at 60 °C — temperature of separation tanks —, showing better performance as breaker, coalescer, and clarifier than FDH-1. Finally, a quantitative structure–activity relationship (QSAR) analysis was carried out employing terpolymers’ molecular parameters and crude oils’ physicochemical parameters. Only one equation fulfilled all thresholds for Q F 1 2 , Q F 2 2 , Q F 3 2 , and r m 2 parameters, proving to be the most accurate to predict the water removal efficiency (WRE) of BAeCe-1 and BAeCe-2 series terpolymers when added to heavy crude oils. This correlation will allow selecting the best terpolymer for demulsifying a petroleum stream as a function of its physicochemical characteristics.