In recent years, the tumour microenvironment (TME) of solid tumours has attracted more and more attention from researchers, especially those non-tumour components such as immune cells. Infiltration of various immune cells causes tumour immune microenvironment (TIME) heterogeneity, and results in different therapeutic effects. Accumulating evidence showed that DNA methylation plays a crucial role in remodelling TIME and is associated with the response towards immune checkpoint inhibitors (ICIs). During carcinogenesis, DNA methylation profoundly changes, specifically, there is a global loss of DNA methylation and increased DNA methylation at the promoters of suppressor genes. Immune cell differentiation is disturbed, and exclusion of immune cells from the TME occurs at least in part due to DNA methylation reprogramming. Therefore, pharmaceutical interventions targeting DNA methylation are promising. DNA methyltransferase inhibitors (DNMTis) enhance antitumor immunity by inducing transcription of transposable elements and consequent viral mimicry. DNMTis upregulate the expression of tumour antigens, mediate immune cells recruitment and reactivate exhausted immune cells. In preclinical studies, DNMTis have shown synergistic effect when combined with immunotherapies, suggesting new strategies to treat refractory solid tumours.