The local environments around mercury atoms in the narrow-bandgap Hg 0.79 Cd 0.21 Te semiconductor alloys have been deduced from extended x-ray absorption fine-structure (EXAFS) analysis. A nonlinear least-squares fitting was applied in order to determine the coordination number, the bond distances and the Debye-Waller factors for the nearest and the next-nearest neighbours around the Hg atom. While ordering has been found for the first coordination shell which consists of four tetrahedrally coordinated Te atoms at 0.280 nm, the next-neighbour shell (consisting of 12 cations) is split into two peaks at the bond lengths of 0.454 nm for Hg-Cd and 0.459 nm for Hg-Hg. Local structure parameters for Krand Xe-ion-implanted Hg 0.79 Cd 0.21 Te crystals are also analysed.