The role of the transcription factor Yin Yang 1 (YY1) in development is largely unknown. Here we show that specific ablation of YY1 in mouse B cells caused a defect in somatic rearrangement in the immunoglobulin heavy-chain (IgH) locus and a block in the progenitor-B-to-precursor-B-cell transition, which was partially rescued by a prerearranged IgH transgene. Three-dimensional DNA fluorescence in situ hybridization analysis revealed an important function for YY1 in IgH locus contraction, a process indispensable for distal V(H) to D(H)J(H) recombination. We provide evidence that YY1 binds the intronic Ei mu enhancer within the IgH locus, consistent with a direct role for YY1 in V(H)D(H)J(H) recombination. These findings identified YY1 as a critical regulator of early B-cell development.