Background. MutS homolog 2 (MSH2), with the function of identifying mismatches and participating in DNA repair, is the “housekeeping gene” in the mismatch repair (MMR) system. MSH2 deficiency has been reported to enhance cancer susceptibility for the association of hereditary nonpolyposis colorectal cancer. However, the expression and prognostic significance of MSH2 have not been studied from the perspective of pan-cancer. Methods. The GTEx database was used to analyze the expression of MSH2 in normal tissues. The TCGA database was used to analyze the differential expression of MSH2 in pan-cancers. The prognostic value of MSH2 in pan-cancer was assessed using Cox regression and Kaplan-Meier analysis. Spearman correlations were used to measure the relationship between the expression level of MSH2 in pan-cancer and the level of immune infiltration, tumor mutational burden (TMB), and microsatellite instability (MSI). Results. MSH2 is highly expressed in most type of cancers and significantly correlated with prognosis. In COAD, KIRC, LIHC, and SKCM, the expression of MSH2 was significantly positively correlated with the abundance of B cells, CD4+ T cells, CD8+ T cells, dendritic cells, macrophages, and neutrophils. In THCA, MSH2 expression correlated with CD8+T Cell showed a significant negative correlation. MSH2 had significantly negative correlations with stromal score and immune score in a variety of cancers and significantly correlated with TMB and MSI of a variety of tumors. Conclusions. MSH2 may play an important role in the occurrence, development, and immune infiltration of cancer. MSH2 can emerge as a potential biomarker for cancer diagnosis and prognosis.