The workfunctions of single-walled carbon nanotubes (SWNTs) with various geometries and adsorbates have been calculated by the ab initio plane-wave, pseudopotential method. The infinitely-long, capped, open-ended, and close-ended nanotubes show the workfunctions of 4.73, 4.8, 4.43 and 3.75 eV, respectively, and these results exhibit a good agreement with experiments. The effects of participation of foreign adsorbates on the nanotube surface both physically and chemically on the variations of workfunctions have also been studied. In the physisorption process, the electrostatic interaction between adsorbates and nanotubes leads to surface charge redistribution and to workfunction variations. In the chemisorption process, various values in workfunction can be understood in terms of the surface dipole of the terminated bond.