Based on first-principles density-functional calculations, we present the structure and diffusion of boron in amorphous silica, as well as in crystalline silica for comparison purpose. We find that incorporation of a boron atom into the amorphous silica matrix results in various minimum-energy configurations with and without oxygen deficient centers, and also the B-related defects can undergo interconversions at elevated temperatures. While B atoms preferentially remain in the trigonal BO 3 form in amorphous silica, our work shows that B diffusion may require transformation of the immobile BO 3 state to a mobile B state by capturing oxygen vacancy related defects equivalent to an S center, which is a combination of an oxygen vacancy and a trivalent Si defect with an unpaired electron. Considering an energy cost for S center creation, our predicted activation energy of B diffusion is in good agreement with experiments. In addition, the defect-mediated diffusion model can explain the observed correlation of B diffusion and Si self-diffusion in amorphous silica.