The results of first principles electronic structure calculations for the metallic rutile and the insulating monoclinic M1 phase of vanadium dioxide are presented. In addition, the insulating M2 phase is investigated for the first time. The density functional calculations allow for a consistent understanding of all three phases. In the rutile phase metallic conductivity is carried by metal t2g orbitals, which fall into the one-dimensional d band, and the isotropically dispersing e π g bands. Hybridization of both types of bands is weak. In the M1 phase splitting of the d band due to metal-metal dimerization and upshift of the e π g bands due to increased p-d overlap lead to an effective separation of both types of bands. Despite incomplete opening of the optical band gap due to the shortcomings of the local density approximation, the metal-insulator transition can be understood as a Peierls-like instability of the d band in an embedding background of e π g electrons. In the M2 phase, the metal-insulator transition arises as a combined embedded Peierls-like and antiferromagnetic instability. The results for VO2 fit into the general scenario of an instability of the rutile-type transition-metal dioxides at the beginning of the d series towards dimerization or antiferromagnetic ordering within the characteristic metal chains. This scenario was successfully applied before to MoO2 and NbO2. In the d 1 compounds, the d and e π g bands can be completely separated, which leads to the observed metal-insulator transitions.