Crude oil emulsions are prevalent in the petroleum industries due to different natural emulsifiers in crude oil. In addition, adding amphiphilic compounds for enhanced oil recovery at high temperatures and pressure under extreme shear stress conditions improved the stability of these emulsions. However, these emulsions are not desirable because they cause different operational problems. Herein, this work aims to synthesize and characterize two novel ionic liquids (ILs) and apply them to the dehydration of water-in-crude oil (W/O) emulsions. For that, tetraethylene glycol (TEG) was reacted with thionyl chloride (TC), yielding dialkyl halide (TEC). After that, TEC was reacted with 4-hexylaniline (HA) or 4-tetradecylaniline (TA) in the presence of sodium carbonate, obtaining the amines TC-HA and TC-TA, respectively. Finally, TC-HA and TC-TA were reacted with acetic acid, yielding the corresponding ionic liquids, THA-IL and TTA-IL. Chemical structure, surface tension (ST), interfacial tension (IFT), thermal stability, and micelle size were investigated using various techniques. The conventional bottle test was used to evaluate the performance of these ILs for dehydration W/O emulsion at different crude oil/brine ratios (ranging from 90/10 to 50/50). The results indicated that the dehydration performance (DP) increased with an increase in IL concentration. In addition, DP improved with increased water contents, reaching 100% for THA-IL and 80% for TTA-IL, respectively, at a crude oil/brine ratio of 50/50. Furthermore, TTA-IL showed higher DP and separated more clear water than THA-IL, which could be linked to its higher ability to reduce IFT due to a longer alkyl chain than THA-IL. The results showed that the synthesized ILs could serve as demulsifiers in the petroleum industry.