Despite the importance of hairpin opening in antigen receptor gene assembly, the molecular machinery that mediates this reaction has not been defined. Here, we show that RAG1 plus RAG2 can open DNA hairpins. Hairpin opening by RAGs is not sequence specific, but in Mg2+, hairpin opening occurs only in the context of a regulated cleavage complex. The chemical mechanism of hairpin opening by RAGs resembles RSS cleavage and 3' end processing by HIV integrase and Mu transposase in that these reactions can proceed through alcoholysis. Mutations in either RAG1 or RAG2 that interfere with RSS cleavage also interfere with hairpin opening, suggesting that RAGs have a single active site that catalyzes several distinct DNA cleavage reactions.