In the crystal structures of the two imidazole derivatives 5-chloro-1,2-dimethyl-4-nitro-1H-imidazole, C5H6ClN3O2, (I), and 2-chloro-1-methyl-4-nitro-1H-imidazole, C4H4ClN3O2, (II), C—Cl...O halogen bonds are the principal specific interactions responsible for the crystal packing. Two different halogen-bond modes are observed: in (I), there is one very short and directional C—Cl...O contact [Cl...O = 2.899 (1) Å], while in (II), the C—Cl group approaches two different O atoms from two different molecules, and the contacts are longer [3.285 (2) and 3.498 (2) Å] and less directional. In (I), relatively short C—H...O hydrogen bonds provide the secondary interactions for building the crystal structure; in (II), the C—H...O contacts are longer but there is a relatively short π–π contact between molecules related by a centre of symmetry. The molecule of (I) is almost planar, the plane of the nitro group making a dihedral angle of 6.97 (7)° with the mean plane of the imidazole ring. The molecule of (II) has crystallographically imposed mirror symmetry and the nitro group lies in the mirror plane.