Based on first-principles spin-polarized density functional theory calculations, the relative stability, electronic structures, and magnetic properties of B-, C-, N-, and F-doped BiFeO 3 are investigated. The substitution of B, C, N, and F for O produces a magnetic moment of 3.0, 2.0, 1.0, and 1.0 m B per dopant, respectively. The net magnetic moments are from the broken of the symmetry of the AFM spin ordering network. We find that the BiFeO 3 with one O atom substituted by a C atom leads to a ferrimagnetic half-metallic property with a C-type spin alignment. The B-and N-doped BiFeO 3 are ferrimagnetic semiconductors, and ordered an A-type and a G-type spin alignment, respectively. As for F-doped case, system becomes metallic in its G-type spin alignment. Our study demonstrates that the nonmagnetic elements doping is an efficient route to tune magnetic and electronic properties in BiFeO 3 .