The lack of good understanding on the electronic structure of individual carbon nanotubes severely limited the applications of carbon nanotubes. By employing density functional theory in combination with the equivalent core hole approximation, we are able to provide near edge x-ray absorption fine structure (NEXAFS) spectra of all possible single walled carbon nanotubes (SWCNTs) with diameters below 1.45 nm. It is shown that the pi(*) absorption edges in NEXAFS spectra of SWCNTs are converged already at the length of 3 nm, while a good description of the full spectra can only be obtained after 7 nm. A recent high resolution experimental spectrum of a bundle of SWCNTs with diameters 1.37+/-0.08 nm has been successfully assigned by the calculations. Noticeable chirality and diameter dependence have been identified for the simulated NEXAFS spectra. The collection of calculated spectra serves as a useful reference for experimental identification of individual carbon nanotubes.