The mechanism for initiating DNA cleavage by DDE-family enzymes, including the RAG endonuclease, which initiates V(D)J recombination, is not well understood. Here we report six cryo-EM structures of zebrafish RAG in complex with one or two intact recombination signal sequences (RSSs), at up to 3.9-Å resolution. Unexpectedly, these structures reveal DNA melting at the heptamer of the RSSs, thus resulting in a corkscrew-like rotation of coding-flank DNA and the positioning of the scissile phosphate in the active site. Substrate binding is associated with dimer opening and a piston-like movement in RAG1, first outward to accommodate unmelted DNA and then inward to wedge melted DNA. These precleavage complexes show limited base-specific contacts of RAG at the conserved terminal CAC/GTG sequence of the heptamer, thus suggesting conservation based on a propensity to unwind. CA and TG overwhelmingly dominate terminal sequences in transposons and retrotransposons, thereby implicating a universal mechanism for DNA melting during the initiation of retroviral integration and DNA transposition.