Context. Formaldehyde (H 2 CO) is a reliable tracer to accurately measure the physical parameters of dense gas in star-forming regions. Aims. We aim to determine directly the kinetic temperature and spatial density with formaldehyde for the ∼100 brightest ATLASGALselected clumps (the TOP100 sample) at 870 µm representing various evolutionary stages of high-mass star formation. Methods. Ten transitions (J = 3-2 and 4-3) of ortho-and para-H 2 CO near 211, 218, 225, and 291 GHz were observed with the Atacama Pathfinder EXperiment (APEX) 12 m telescope. Results. Using non-LTE models with RADEX, we derived the gas kinetic temperature and spatial density with the measured para-H 2 CO 3 21 -2 20 /3 03 -2 02 , 4 22 -3 21 /4 04 -3 03 , and 4 04 -3 03 /3 03 -2 02 ratios. The gas kinetic temperatures derived from the para-H 2 CO 3 21 -2 20 /3 03 -2 02 and 4 22 -3 21 /4 04 -3 03 line ratios are high, ranging from 43 to >300 K with an unweighted average of 91 ± 4 K. Deduced T kin values from the J = 3-2 and 4-3 transitions are similar. Spatial densities of the gas derived from the para-H 2 CO 4 04 -3 03 /3 03 -2 02 line ratios yield 0.6-8.3 × 10 6 cm −3 with an unweighted average of 1.5 (±0.1) × 10 6 cm −3 . A comparison of kinetic temperatures derived from para-H 2 CO, NH 3 , and dust emission indicates that para-H 2 CO traces a distinctly higher temperature than the NH 3 (2,2)/(1,1) transitions and the dust, tracing heated gas more directly associated with the star formation process. The H 2 CO line widths are found to be correlated with bolometric luminosity and increase with the evolutionary stage of the clumps, which suggests that higher luminosities tend to be associated with a more turbulent molecular medium. It seems that the spatial densities measured with H 2 CO do not vary significantly with the evolutionary stage of the clumps. However, averaged gas kinetic temperatures derived from H 2 CO increase with time through the evolution of the clumps. The high temperature of the gas traced by H 2 CO may be mainly caused by radiation from embedded young massive stars and the interaction of outflows with the ambient medium. For L bol /M clump 10 L ⊙ /M ⊙ , we find a rough correlation between gas kinetic temperature and this ratio, which is indicative of the evolutionary stage of the individual clumps. The strong relationship between H 2 CO line luminosities and clump masses is apparently linear during the late evolutionary stages of the clumps, indicating that L H 2 CO does reliably trace the mass of warm dense molecular gas. In our massive clumps H 2 CO line luminosities are approximately linearly correlated with bolometric luminosities over about four orders of magnitude in L bol , which suggests that the mass of dense molecular gas traced by the H 2 CO line luminosity is well correlated with star formation.