Four novel environmentally friendly and highly branched crude oil demulsifiers were prepared by using different molecular weight (Mn = 350, 750, 1000, 1900 g/mol) of methoxy poly(ethylene glycol) to modify quaternized N,O‐carboxymethyl chitosan. Fourier transform infrared and 1H‐nuclear magnetic resonance were employed to confirm the structure of the demulsifiers. The surface tension of demulsifies was determined and hydrophile–lipophile balance value was calculated at the critical micelle concentration. The demulsification performance was evaluated by the bottle test method against water‐in‐oil emulsions simulated in the laboratory and it was found that the dehydration rate of four demulsifiers can come to 74.2%–80.4%, which have better demulsification performance than the commercial demulsifier JL‐1. Demulsification mechanism was discussed, and it was encouraging to find that the tiny water droplets in the emulsion coalesced to form the water phase and separated with the water from the polarization microscope. Results show that methoxy poly(ethylene glycol) grafted quaternized carboxymethyl chitosan has a promising application as a demulsifiers for dealing with W/O crude oil emulsions. © 2017 Wiley Periodicals, Inc. J. Appl. Polym. Sci. 2018, 135, 45867.