Abstract. The sulphur chemistry in nine regions in the earliest stages of high-mass star formation is studied through singledish submillimeter spectroscopy. The line profiles indicate that 10-50% of the SO and SO 2 emission arises in high-velocity gas, either infalling or outflowing. For the low-velocity gas, excitation temperatures are 25 K for H 2 S, 50 K for SO, H 2 CS, NS and HCS + , and 100 K for OCS and SO 2 , indicating that most observed emission traces the outer parts (T < 100 K) of the molecular envelopes, except high-excitation OCS and SO 2 lines. Abundances in the outer envelopes, calculated with a Monte Carlo program, using the physical structures of the sources derived from previous submillimeter continuum and CS line data, are ∼10 −8 for OCS, ∼10 −9 for H 2 S, H 2 CS, SO and SO 2 , and ∼10 −10 for HCS + and NS. In the inner envelopes (T > 100 K) of six sources, the SO 2 abundance is enhanced by a factor of ∼100-1000. This region of hot, abundant SO 2 has been seen before in infrared absorption, and must be small, < ∼ 0. 2 (180 AU radius). The derived abundance profiles are consistent with models of envelope chemistry which invoke ice evaporation at T ∼ 100 K. Shock chemistry is unlikely to contribute. A major sulphur carrier in the ices is probably OCS, not H 2 S as most models assume. The source-to-source abundance variations of most molecules by factors of ∼10 do not correlate with previous systematic tracers of envelope heating. Without observations of H 2 S and SO lines probing warm ( > ∼ 100 K) gas, sulphur-bearing molecules cannot be used as evolutionary tracers during star formation.