The electronic structure, intrinsic defects and extrinsic doping of SnO2 are studied by using the hybrid functional method. Research shows that SnO2 is a direct gap semiconductor. Along the Γ-M (Γ-Z) direction, the electron effective mass is 0.23 (0.19) m0 (m0: the mass of the free electron). When the Hartree-Fock mixing parameter (α) increases to 38%, the calculated band gap for SnO2 is 3.53 eV, which is close to the experimental results. For nonstoichiometric SnO2, both VO and Snint are major n-type defects, and the ionization energies ε(0/+) are above the conduction band minimum (CBM). About Ta-doped SnO2, obtained results show Ta substituting Sn (TaSn) is a predominate n-type defect. This work could promote the understanding of the n-type conductivity of SnO2 and provide significant guidance for their applications in transparent electronics.