Abstract In this paper, a series of single-walled carbon nanotubes’ optical properties are researched by using the ABINIT software package. The results show that the dielectric function and absorption coefficient of carbon nanotubes are related to both their geometric structure and their electronic structure. This has a guiding role for the further research of the optical properties of doped carbon nanotubes, carbon nanotubes with defects, and carbon nanotube arrays.