Context. Among the spectroscopically identified white dwarfs, a fraction smaller than 2% have spectra dominated by carbon lines, mainly molecular C 2 , but also in a smaller group by C i and C ii lines. These are together called DQ white dwarfs. Aims. We want to derive atmospheric parameters T eff , log g, and carbon abundances for a large sample of these stars and discuss implications for their spectral evolution. Methods. Sloan Digital Sky Survey spectra and ugriz photometry were used, together with Gaia Data Release 2 parallaxes and G band photometry. These were fitted to synthetic spectra and theoretical photometry derived from model atmospheres.Results. We found that the DQs hotter than T eff ≈10000 K have masses ≈0.4 M ⊙ larger than the classical DQ, which have masses typical for the majority of white dwarfs (≈0.6 M ⊙ ). We found some evidence that the peculiar DQ below 10000 K also have significantly larger masses and may thus be the descendants of the hot and warm DQs above 10000 K. A significant fraction of the hotter objects with T eff > 14500 K have atmospheres dominated by carbon.