The sodium/hydrogen antiporter (NHX) gene family with the Na + /H + exchange protein domain is a transporter of sodium and hydrogen ions and plays an important role in the response of plants to salt stress. Studying the response of cotton to salt stress through comprehensive identification and analysis of NHX genes in several species and their roles in salt tolerance mechanisms is of great significance. In this study, 23, 24, 12, and 12 NHX genes were identified from Gossypium hirsutum (Gh), G. barbadense, G. arboreum and G. raimondii, respectively. Phylogenetic analysis showed that these genes were mainly divided into three clades with significant subcellular localization, namely, endosome (Endo-class), plasma membrane (PM-class) and vacuole (Vac-class). By analyzing the structure of NHX genes and proteins, each branch of the NHX gene family was found to be structurally conserved, and collinearity analysis showed that NHX genes were mainly expressed through whole genome and segmental duplication. The non-synonymous (Ka)/synonymous (Ks) values showed that the NHX gene family experienced strong purifying selection during long-term evolution. Cis-acting element analysis showed that the NHX gene family may be related to the regulation of abscisic acid (ABA) and methyl jasmonate (MeJA) hormones. Additionally, transcriptomic data analysis and qRT-PCR showed that GhNHXs exhibited different expression patterns in each tissue and under different salinities. These results provide an important reference for us to further understand and analyze the molecular regulation mechanism of cotton NHX genes.