B lymphopoiesis is the result of several cell-commitment, lineage-choice, and differentiation processes. Every differentiation step is characterized by the activation of a new, lineage-specific, genetic program and the extinction of the previous one. To date, the central role of specific transcription factors in positively regulating these distinct differentiation processes to acquire a B cell-specific genetic program is well established. However, the existence of specific transcriptional repressors responsible for the silencing of lineage inappropriate genes remains elusive. Here we addressed the molecular mechanism behind repression of non-lymphoid genes in B cells. We report that the histone deacetylase HDAC7 was highly expressed in pre-B cells but dramatically down-regulated during cellular lineage conversion to macrophages. Microarray analysis demonstrated that HDAC7 re-expression interfered with the acquisition of the gene transcriptional program characteristic of macrophages during cell transdifferentiation; the presence of HDAC7 blocked the induction of key genes for macrophage function, such as immune, inflammatory, and defense response, cellular response to infections, positive regulation of cytokines production, and phagocytosis. Moreover, re-introduction of HDAC7 suppressed crucial functions of macrophages, such as the ability to phagocytose bacteria and to respond to endotoxin by expressing major pro-inflammatory cytokines. To gain insight into the molecular mechanisms mediating HDAC7 repression in pre-B cells, we undertook co-immunoprecipitation and chromatin immunoprecipitation experimental approaches. We found that HDAC7 specifically interacted with the transcription factor MEF2C in pre-B cells and was recruited to MEF2 binding sites located at the promoters of genes critical for macrophage function. Thus, in B cells HDAC7 is a transcriptional repressor of undesirable genes. Our findings uncover a novel role for HDAC7 in maintaining the identity of a particular cell type by silencing lineage-inappropriate genes.