Background. Keloids are benign fibroproliferative tumors that are unique to humans. However, the exact mechanism of keloid formation remains unclear. The inflammatory cytokines released by immune cells can activate fibroblasts, connective tissue cell proliferation, and angiogenesis. Hypoxia is common in the process of fibrosis in many diseases. This study aimed to investigate the relationship between immune response, hypoxia, and keloid formation. Methods. Gene methylation and expression data were downloaded from the GEO database. Thereafter, differentially methylated genes associated with immunity and hypoxia were identified. Machine learning was performed to identify potential diagnostic/immunity/hypoxia‐related differentially methylated/expressed genes, followed by analysis of functional enrichment, transcription factors, protein‐protein interactions, and expression validation by reverse transcription quantitative polymerase chain reaction and immunohistochemistry. Results. In total, 16 immunity/hypoxia‐related hypermethylated low‐expression genes and 18 immunity/hypoxia‐related hypomethylated high‐expression genes were identified in keloids. Based on machine learning, nine differentially methylated and expressed genes were selected as potential diagnostic markers for keloids, including two hypoxia‐related genes (CDKN1A and PGAM2) and seven immunity‐related genes (DCD, PTGDS, WFIKKN1, SEMA5A, IL1R1, ITGAL, and SOS1). Some significantly enriched signaling pathways were identified, including the FoxO, PI3K‐Akt, focal adhesion, and ErbB signaling pathways. SOS1 is involved in disease regulation with 65 transcription factors and has a higher interaction score with other molecules. Conclusions. Two hypoxia‐related genes (CDKN1A and PGAM2) and seven immunity‐related genes (DCD, PTGDS, WFIKKN1, SEMA5A, IL1R1, ITGAL, and SOS1) could be considered potential diagnostic markers for keloids, and may be helpful in understanding the importance of oxygen balance and immune regulation in keloids.