The structures and electronic properties of single-walled carbon nanotubes (SWNTs) under torsions are investigated using first-principles calculation based on the density functional theory. A SWNT of the chiral indices (5,0) is equilibrated under a torsion, and its equilibrium energy is obtained. It is revealed there is a structure having the minimum energy at a torsion of a specific angle of twist between 0 deg/Å and 1.88 deg/Å. Next, shear deformations corresponding to torsions imposed on the SWNTs of the chiral indices (5,0) and (5,1) are given to graphene sheets, and their energy band structures are calculated. It is concluded their band gaps decrease with the increase of the specific angle of twist.