In the last five years, biology has undergone a seismic shift as researchers around the globe have embraced a revolutionary technology called gene editing. It involves the precise cutting and pasting of DNA by specialized proteins—inspired by nature, engineered by researchers. These proteins come in three varieties, all known by their somewhat clumsy acronyms: ZFNs, TALENs, and CRISPRs. But it’s Crispr, with its elegant design and simple cell delivery, that’s most captured the imagination of scientists. They’re now using it to treat genetic diseases, grow climate-resilient crops, and develop designer materials, foods, and drugs.

So how does it work?

When people refer to Crispr, they're probably talking about Crispr-Cas9, a complex of enzymes and genetic guides that together finds and edits DNA. But Crispr on its own just stands for Clustered Regularly Interspaced Palindromic Repeats—chunks of regularly recurring bits of DNA that arose as an ancient bacterial defense system against viral invasions.

LEARN MORE The WIRED Guide to Crispr

Viruses work by taking over a cell, using its machinery to replicate until it bursts. So certain bacteria evolved a way to fight back. They deployed waves of DNA-cutting proteins to chop up any viral genes floating around. If the bacteria survived the attacks, they'd incorporate tiny snippets of virus DNA into their own genomes—like a mug shot of every foe they’d ever come across, so they could spot each one quicker in the future. To keep their genetic memory palace in order, they spaced out each bit of viral code (so-called “guide RNAs”) with those repetitive, palindromic sequences in between. It doesn't really matter that they read the same forward and backward; the important thing is that they helped file away genetic code from viral invaders past, far away from more essential genes.

And having them on file meant that the next time a virus returned, the bacteria could send out a more powerful weapon. They could equip Cas9—a lumpy, clam-shaped DNA-cutting protein—with a copy of that guide RNA, pulled straight out of storage. Like a molecular assassin, it would go out and snip anything that matched the genetic mug shot.

That’s what happens in the wild. But in the lab, scientists have harnessed this powerful Crispr system to do things other than fight off the flu. The first step is designing a guide RNA that can sniff out a particular block of code in any living cell—say, a genetic defect, or an undesirable plant trait. If that gene consists of a string of the bases A, A, T, G, C, scientists make a complementary strand of RNA: U, U, A, C, G. Then they inject this short sequence of RNA, along with Cas9, into the cell they’re trying to edit. The guide RNA forms a complex with Cas9; one end of the RNA forms a hairpin curve that keeps it stuck in the protein, while the other end—the business end—dangles out to interact with any DNA it comes across.

Once in the cell's nucleus, the Crispr-Cas9 complex bumps along the genome, attaching every time it comes across a small sequence called PAM. This “protospacer adjacent motif” is just a few base pairs, but Cas9 needs it to grab onto the DNA. And by grabbing it, the protein is able to destabilize the adjacent sequence, unzipping just a little bit of the double helix. That allows the guide RNA to slip in and sniff around to see if it's a match. If not, they move on. But if every base pair lines up to the target sequence, the guide RNA triggers Cas9 to produce two pincer-like appendages, which cut the DNA in two.

The process can stop there, and simply take a gene out of commission. Or, scientists can add a bit of replacement DNA—to repair a gene instead of knocking it out.