Vitiligo is a common immune-related depigmentation condition, and its pathogenesis remains unclear. This study used a combination of bioinformatics methods and expression analysis techniques to explore the relationship between immune cell infiltration and gene expression in vitiligo. Previously reported gene expression microarray data from the skin (GSE53146 and GSE75819) and peripheral blood (GSE80009 and GSE90880) of vitiligo patients and healthy controls was used in the analysis. R software was used to filter the differentially expressed genes (DEGs) in each dataset, and the KOBAS 2.0 server was used to perform functional enrichment analysis. Compared with healthy controls, the upregulated genes in skin lesions and peripheral blood leukocytes of vitiligo patents were highly enriched in immune response pathways and inflammatory response signaling pathways. Immunedeconv software and the EPIC method were used to analyze the expression levels of marker genes to obtain the immune cell population in the samples. In the lesional skin of vitiligo patients, the proportions of macrophages, B cells and NK cells were increased compared with healthy controls. In the peripheral blood of vitiligo patients, CD8+ T cells and macrophages were significantly increased. A coexpression analysis of the cell populations and DEGs showed that differentially expressed immune and inflammation response genes had a strong positive correlation with macrophages. The TLR4 receptor pathway, interferon gamma-mediated signaling pathway and lipopolysaccharide-related pathway were positively correlated with CD4+ T cells. Regarding immune response-related genes, the overexpression of IFITM2, TNFSF10, GZMA, ADAMDEC1, NCF2, ADAR, SIGLEC16, and WIPF2 were related to macrophage abundance, while the overexpression of ICOS, GPR183, RGS1, ILF2 and CD28 were related to CD4+ T cell abundance. GZMA and CXCL10 expression were associated with CD8+ T cell abundance. Regarding inflammatory response-related genes, the overexpression of CEBPB, ADAM8, CXCR3, and TNIP3 promoted macrophage infiltration. Only ADORA1 expression was associated with CD4+ T cell infiltration. ADAM8 and CXCL10 expression were associated with CD8+ T cell abundance. The overexpression of CCL18, CXCL10, FOS, NLRC4, LY96, HCK, MYD88, and KLRG1, which are related to inflammation and immune responses, were associated with macrophage abundance. We also found that immune cells infiltration in vitiligo was associated with antigen presentation-related genes expression. The genes and pathways identified in this study may point to new directions for vitiligo treatment.