Oligonucleotides synthesized in array format suffer from contamination by truncated species. We have developed a method to invert DNA molecules in situ after completed synthesis. Reactive functions at the 5'-ends of the oligonucleotides are permitted to react with functions on the support before the 3'-ends are released, in effect reversing the orientation of full-length oligonucleotides, while any 5'-truncated molecules are lost. This strategy serves both to purify in situ synthesized reagents and to reorient the oligonucleotides, causing them to expose free 3'-hydroxyls. In situ inverted oligonucleotides can be used in assays based on DNA polymerase-assisted extension of immobilized primers, and we demonstrate their utility in minisequencing and in pyrosequencing.