A rapid, simple and versatile method is described for the extraction from agarose gels of small plasmid molecules and DNA fragments generated by restriction endonucleases. The method may be used also for the extraction of RNA from agarose-urea gels. It is based on the partitioning of nucleic acid molecules into 1-butanol as their quaternary ammonium salts, leaving the neutral agarose in the aqueous phase. The nucleic acid is then recovered as the sodium salt by partition back into an aqueous phase. Nucleic acid samples were found to be unaffected by the treatment, as judged by their ability to be ligated, transformed, nick-translated, and used in an in vitro protein-synthesizing system.