The spectral distortion of the cosmic background radiation produced by the inverse Compton scattering on hot electrons in clusters of galaxies (thermal Sunyaev--Zel'dovich effect) together with X-ray data provide good distance measurements over a wide range of redshifts. This allows us to make independent measurements of the Hubble constant. In this talk we discuss CMB distortion for arbitrary optical depth and electron temperature.