The structure of racemic (RS)-trichlormethiazide [systematic name: (RS)-6-chloro-3-(dichloromethyl)-1,1-dioxo-3,4-dihydro-2H-1λ6,2,4-benzothiadiazine-7-sulfonamide], C8H8Cl3N3O4S2 (RS-TCMZ), a diuretic drug used in the treatment of oedema and hypertension, was determined from laboratory X-ray powder diffraction data using DASH [David et al. (2006). J. Appl. Cryst.
39, 910–915.], refined by the Rietveld method with TOPAS-Academic [Coelho (2018). J. Appl. Cryst.
51, 210–218], and optimized using DFT-D calculations. The extended structure consists of head-to-tail dimers connected by π–π interactions which, in turn, are connected by C—Cl...π interactions. They form chains propagating along [101], further connected by N—H...O hydrogen bonds to produce layers parallel to the ac plane that stack along the b-axis direction, connected by additional N—H...O hydrogen bonds. The Hirshfeld surface analysis indicates a major contribution of H...O and H...Cl interactions (32.2 and 21.7%, respectively). Energy framework calculations confirm the major contribution of electrostatic interactions (E
elec) to the total energy (E
tot). A comparison with the structure of S-TCMZ is also presented.