This study describes an on-line stacking CE approach by sweeping with whole capillary sample filling for analyzing five anabolic androgenic steroids in urine samples. The five anabolic steroids for detection were androstenedione, testosterone, epitestosterone, boldenone, and clostebol. Anabolic androgenic steroids are abused in sport doping because they can promote muscle growth. Therefore, a sensitive detection method is imperatively required for monitoring the urine samples of athletes. In this research, an interesting and reliable stacking capillary electrophoresis method was established for analysis of anabolic steroids in urine. After liquid–liquid extraction by n-hexane, the supernatant was dried and reconstituted with 30 mM phosphate buffer (pH 5.00) and loaded into the capillary by hydrodynamic injection (10 psi, 99.9 s). The stacking and separation were simultaneously accomplished at −20 kV in phosphate buffer (30 mM, pH 5.0) containing 100 mM sodium dodecyl sulfate and 40 % methanol. During the method validation, calibration curves were linear (r ≥ 0.990) over a range of 50–1,000 ng/mL for the five analytes. In the evaluation of precision and accuracy for this method, the absolute values of the RSD and the RE in the intra-day (n = 3) and inter-day (n = 5) analyses were all less than 6.6 %. The limit of detection for the five analytes was 30 ng/mL (S/N = 5, sampling 99.9 s at 10 psi). Compared with simple MECK, this stacking method possessed a 108- to 175-fold increase in sensitivity. This simple and sensitive stacking method could be used as a powerful tool for monitoring the illegal use of doping.