Responsible for the deacetylation of lysine residues on the N-terminal part of the core histones (H2A, H2B, H3 and H4). Histone deacetylation gives a tag for epigenetic repression and plays an important role in transcriptional regulation, cell cycle progression and developmental events. Histone deacetylases act via the formation of large multiprotein complexes. Involved in muscle maturation by repressing transcription of myocyte enhancer MEF2C. During muscle differentiation, it shuttles into the cytoplasm, allowing the expression of myocyte enhancer factors (By similarity). Serves as a corepressor of RARA and causes its deacetylation (By similarity). In association with RARA, plays a role in the repression of microRNA-10a and thereby in the inflammatory response (By similarity). H2O + N(6)-acetyl-L-lysyl-[histone] = acetate + L-lysyl-[histone] Interacts with AHRR, BAHD1, BCOR, HDAC7, HDAC9, CTBP1, MEF2C, NCOR2, NRIP1, PHB2 and a 14-3-3 chaperone protein. Interacts with BCL6, DDIT3/CHOP, GRK5, KDM5B and MYOCD. Interacts with EP300 in the presence of TFAP2C. Interacts with ANKRA2. Interacts with CUL7 (as part of the 3M complex); negatively regulated by ANKRA2. Interacts with ZBTB7B; the interaction allows the recruitment of HDAC4 on CD8 loci for deacetylation and possible inhibition of CD8 genes expression (By similarity). Interacts with RARA (By similarity). Shuttles between the nucleus and the cytoplasm. In muscle cells, it shuttles into the cytoplasm during myocyte differentiation. The export to cytoplasm depends on the interaction with a 14-3-3 chaperone protein and is due to its phosphorylation at Ser-259 and Ser-498 by AMPK, CaMK1 and SIK1 (By similarity). The nuclear export sequence mediates the shuttling between the nucleus and the cytoplasm. Phosphorylated by AMPK, CaMK1, SIK1 and PRKD1 at Ser-259 and Ser-498. The phosphorylation is required for the export to the cytoplasm and inhibition. Phosphorylated by the PKC kinases PKN1 and PKN2, impairing nuclear import (By similarity). Phosphorylated by GRK5, leading to nuclear export of HDAC5 and allowing MEF2-mediated transcription (By similarity). Ubiquitinated. Polyubiquitination however does not lead to its degradation (By similarity). Belongs to the histone deacetylase family. HD type 2 subfamily.