The electronic structures of carbon (C) and boron nitride (BN) nanotubes under a transverse electric field were investigated through the first-principles pseudopotential density-functional theory (DFT) calculations. It was found that band gap modifications occur both in the semiconducting C and BN nanotubes under an external electric field by inducing a semiconductor–metal transition. The variations of the band gap sizes with transverse electric fields are very different between C and BN nanotubes. In the semiconducting C nanotube, a sharp semiconductor–metal transition does not occur until a threshold electric field is achieved; the BN nanotube, on the other hand, shows a gradual reduction of the band gap size once an external electric field is applied due to the larger ionicity of BN bonds. In addition, the semiconductor–metal transition in both C and BN nanotubes occurs at a lower value of electric field with increasing diameter. The ability to tune the band gap in both C and BN nanotubes by an external electric field provides the possibility for future electronic and electro-optic nanodevice applications.