Background High-grade anal intraepithelial neoplasia (AIN2/3; HGAIN) is highly prevalent in human immunodeficiency virus positive (HIV+) men who have sex with men (MSM), but only a minority will eventually progress to cancer. Currently, the cancer risk cannot be established, and therefore all HGAIN is treated, resulting in overtreatment. We assessed host cell deoxyribonucleic acid (DNA) methylation markers for detecting HGAIN and anal cancer. Methods Tissue samples of HIV+ men with anal cancer (n = 26), AIN3 (n = 24), AIN2 (n = 42), AIN1 (n = 22) and HIV+ male controls (n = 34) were analyzed for methylation of 9 genes using quantitative methylation-specific polymerase chain reaction. Univariable and least absolute shrinkage and selection operator logistic regression, followed by leave-one-out cross-validation, were used to determine the performance for AIN3 and cancer detection. Results Methylation of all genes increased significantly with increasing severity of disease (P < 2 × 10 -6). HGAIN samples revealed heterogeneous methylation patterns, with a subset resembling cancer. Four genes (ASCL1, SST, ZIC1,ZNF582) showed remarkable performance for AIN3 and anal cancer detection (area under the curve [AUC] > 0.85). ZNF582 (AUC = 0.89), detected all cancers and 54% of AIN3 at 93% specificity. Slightly better performance (AUC = 0.90) was obtained using a 5-marker panel. Conclusions DNA methylation is associated with anal carcinogenesis. A marker panel that includes ZNF582 identifies anal cancer and HGAIN with a cancer-like methylation pattern, warrantingvalidation studies to verify its potential for screening and management of HIV+ MSM at risk for anal cancer.