Based on first-principles calculation, it has been predicted that the magnetic anisotropy energy (MAE) in Co-doped ZnO (Co:ZnO) depends on electron-filling. Results show that the charge neutral Co:ZnO presents a easy plane magnetic state. While modifying the total number of electrons, the easy axis rotates from in-plane to out-of-plane. The alternation of the MAE is considered to be the change of the ground state of Co ion, resulting from the relocating of electrons on Co d-orbitals with electron-filling.