A sensitive method for the simultaneous determination of azithromycin (AZI), tilmicosin (TIL), acetylspiramycin (ACE), and roxithromycin (ROX) has been established using capillary electrophoresis (CE) coupled with electrochemiluminescence (ECL) detection. The use of ionic liquid (IL) significantly improved separation efficiency and detection sensitivity. The conditions for CE separation and ECL detection were investigated in detail. Under the optimal conditions, the four macrolides were well separated and detected within 7 min. The limits of detection (LOD, S/N = 3) of AZI, TIL, ACE, and ROX were 1.3 x 10-9, 2.5 x 10-9, 2.3 x 10-8, and 7.0 x 10-8 mol L-1, respectively. The precisions of the peak area and migration times were from 1.1 to 4.9% and from 1.3 to 2.4% within a day and from 3.3 to 6.0% and from 2.4 to 4.8% in three days. The limits of quantitation (LOQ, S/N = 10) in human urine for AZI, TIL, ACE, and ROX were 9.3 x 10-8, 1.2 x 10-7, 7.6 x 10-7, and 2.1 x 10-6 mol L-1, respectively. The recoveries of the four analytes at different concentration levels, found in human urine, drug, pig fodder, and egg samples were between 87.4 - 107.9% with relative standard deviations (RSDs) ranging from 1.0 to 7.2%. The developed method has been successfully applied to the determination of AZI, TIL, ACE, and ROX in human urine, tablets, pig fodder, and egg samples.