Among the spectroscopically identified white dwarfs, a fraction smaller than 2% have spectra dominated by carbon lines, mainly molecular C2, but also in a smaller group by CI and CII lines. These are together called DQ white dwarfs. We want to derive atmospheric parameters Teff,log g, and carbon abundances for a large sample of these stars and discuss implications for their spectral evolution. 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. We found that the DQs hotter than Teff ~10000 K have masses ~0.4 Msun larger than the cooler ones, which have masses typical for the majority of white dwarfs, ~0.6 Msun. A significant fraction of the hotter objects with Teff > 14500 K have atmospheres dominated by carbon.