Theoretical calculations on the effects of different Sr-doped ratios and oxygen vacancy concentrations on the magnetic mechanism of anatase TiO2 are rarely reported. For this problem, generalized gradient approximation (GGA) plane wave ultra-soft pseudopotential [Formula: see text]U based on the spin density functional theory framework was adopted in this work. The effect of different Sr doping ratios and O vacancy concentrations on the magnetic properties of anatase TiO2 was studied by first principles. Results show that Sr replaces Ti and O vacancies at different Sr:V[Formula: see text] ratios (1:0, 1:1, 1:2, 2:1 and 2:2), the doping system is magnetic when the Sr:V[Formula: see text] ratio is 1:2. The systems with Sr[Formula: see text]:V[Formula: see text] ratios of 1:0 and 2:1 are nonmagnetic, whereas those with 1:1, 1:2, and 2:2 Sr[Formula: see text]:V[Formula: see text] ratios are magnetic. Regardless of whether or not Sr replaces Ti and O vacancies or interstitial Sr and O vacancies in different ratios of anatase TiO2, the effect of magnetic switching can be achieved by adjusting the concentration. In this study, the largest magnetic moment of Ti[Formula: see text]Sr[Formula: see text]O[Formula: see text] system is obtained at Sr[Formula: see text]:V[Formula: see text] ratio of 2:2. The Curie temperature of the doping system is above room-temperature, and the doping system produces 100% electron spin polarizability and is half-metallized. These features are valuable to the design and preparation of novel dilute magnetic semiconductors with spin-electron injection sources. The main magnetic sources of the Ti[Formula: see text]Sr[Formula: see text]O[Formula: see text] system are the holes generated by doped Sr and O vacancy complexes, which cause the spin polarization double exchange of Ti-3d electron orbitals and O-2p electron orbits near O vacancies. This result is consistent with the average field approximation and dual exchange mechanism theories.