The electronic structure and electron g factors of HgTe quantum dots are investigated, in the framework of the eight-band effective-mass approximation. It is found that the electron states of quantum spheres have aspheric properties due to the interaction between the conduction band and valence band. The highest hole states are S (l = 0) states, when the radius is smaller than 9.4 nm. the same as the lowest electron states. Thus strong luminescence from H-Te quantum dots with radius smaller than 9.4 nm has been observed (Rogach et al 2001 Phys. Statits Solidi b 224 153). The bandgap of H-Te quantum spheres is calculated and compared with earlier experimental results (Harrison et al 2000 Pure Appl. Chem. 72 295). Due to the quantum confinement effect, the bandgap of the small HgTe quantum spheres is positive. The electron g factors of HgTe quantum spheres decrease with increasing radius and are nearly 2 when the radius is very small. The electron g factors of HgTe quantum ellipsoids are also investigated. We found that as some of the three dimensions increase, the electron g factors decrease. The more the dimensions increase, the more the g factors decrease. The dimensions perpendicular to the direction of the magnetic field affect the g factors more than the other dimension.