This study compares three different pretreatment protocols for the immunohistochemical detection of 5-methylcytosine (5-mC) and 5-hydroxymethylcytosine (5-hmC) in nuclear DNA. The human biological samples analyzed included formalin-fixed and paraffin-embedded (FFPE) normal squamous epithelium, ethanol-fixed cultured cells, and metaphase chromosomes. The antigen retrieval methods included low pH Citrate and high pH Tris–ethylenediaminetetraacetic acid (EDTA) protocols, as well as a method using Pepsin pretreatment combined with HCl for DNA denaturation. A gradual increase in the detection levels of 5-mC and 5-hmC was observed when going from Citrate via Tris/EDTA to Pepsin/HCl retrieval. While the Citrate retrieval protocol was the least efficient for the detection of 5-mC and 5-hmC, it did preserve nuclear morphology and enabled visualization of differences in intra- and internuclear distribution patterns in tissue and cell culture samples by single- and double-fluorescence detection. Quantification of (hydroxy)methylation levels in FFPE material demonstrated a significant heterogeneity and differences in 5-mC and 5-hmC levels within and between nuclei in the different compartments of normal squamous epithelium. It was concluded that immunohistochemical detection of 5-mC and 5-hmC enables the correlation of these DNA modifications with histomorphological features in heterogeneous tissues, but this is influenced by different pretreatment protocols that must be carefully chosen to allow an appropriate interpretation of these epigenetic switches.Supplementary InformationThe online version contains supplementary material available at 10.1007/s00418-023-02187-4.