Why DNA Has a Reverse Complement
A DNA molecule is two strands held together by base pairs: adenine (A) pairs with thymine (T), and guanine (G) pairs with cytosine (C). Each strand has a direction, named after the carbon atoms of its sugar backbone: one end is 5′ (five prime) and the other is 3′ (three prime).
The two strands run in opposite directions, which is called antiparallel. By convention, sequences are always written and read from 5′ to 3′. So once you know one strand, the other strand is fully determined, but to write it the standard way you have to read it backwards.
How to Work It Out by Hand
- Write the complement. Replace every A with T, T with A, G with C and C with G.
- Reverse it. Write the result from the last base to the first.
- Label the ends. The result starts at 5′ and ends at 3′.
For 5′-GATTACA-3′, the complement is CTAATGT and the reverse complement is 5′-TGTAATC-3′. Doing the two steps in the other order (reverse first, then complement) gives the same answer.
Reverse, Complement and Reverse Complement
The three operations are easy to mix up. Here they are side by side for ATGCCGTAA:
| Operation | Result | What it means |
|---|---|---|
| Reverse | AATGCCGTA | The same strand read backwards (3′→5′). Rarely what you want. |
| Complement | TACGGCATT | The partner strand, written 3′→5′ so it lines up under the original. |
| Reverse complement | TTACGGCAT | The partner strand written 5′→3′. This is the one most tools and databases expect. |
Where You Need It
PCR Primers
A PCR reaction uses a forward primer that matches the top strand and a reverse primer that binds to the top strand near the far end of the target. The reverse primer is therefore the reverse complement of that stretch of top-strand sequence. If the end of your target reads 5′-CTGACCTAGGTTCAAG-3′, the reverse primer is 5′-CTTGAACCTAGGTCAG-3′.
Sequencing Reads and Search Hits
Reads and BLAST hits can come from either strand. A hit on the minus strand matches the reverse complement of your query, so comparing it by eye means converting one of them first.
Restriction Sites
Many restriction enzymes recognise palindromic sites: sequences that equal their own reverse complement. EcoRI’s site GAATTC and BamHI’s site GGATCC both read the same on either strand.
Probes and Antisense Sequences
A probe or antisense oligonucleotide must pair with its target, so it is designed as the reverse complement of the target sequence.
RNA
RNA uses uracil (U) instead of thymine, so A pairs with U. The reverse complement of 5′-AUGGCU-3′ is 5′-AGCCAU-3′. In DNARev, choose RNA as the sequence type to complement A↔U. In DNA mode, U is treated as an invalid character and removed, which is how the original Sequence Manipulation Suite behaves.
RNA can also form G–U “wobble” pairs inside folded structures, but a reverse complement always uses the standard Watson–Crick pairs.
Ambiguity (IUPAC) Codes
When a position is uncertain, sequences use IUPAC codes. Each code has a defined complement:
| Code | Means | Complement |
|---|---|---|
R | A or G (purine) | Y |
Y | C or T (pyrimidine) | R |
K | G or T | M |
M | A or C | K |
S | G or C | S |
W | A or T | W |
B | not A | V |
V | not T | B |
D | not C | H |
H | not G | D |
N | any base | N |
DNARev keeps N but removes the other ambiguity codes, exactly as the Sequence Manipulation Suite does, and shows a note when that happens. Check the length of the result if your input contains them.
In Python
For plain DNA, a translation table and a slice are enough:
def reverse_complement(seq):
pairs = str.maketrans("ACGTNacgtn", "TGCANtgcan")
return seq.translate(pairs)[::-1]
print(reverse_complement("ATGCCGTAA")) # TTACGGCAT
With Biopython, use the methods on Seq:
from Bio.Seq import Seq
Seq("ATGCCGTAA").reverse_complement() # Seq('TTACGGCAT')
Seq("AUGGCU").reverse_complement_rna() # Seq('AGCCAU')
Common Mistakes
- Reversing without complementing, or complementing without reversing. Only the reverse complement gives the partner strand in 5′→3′ order.
- Dropping the direction labels. Without 5′ and 3′, nobody can tell which way a sequence was written.
- Mixing T and U. Use DNA rules for DNA and RNA rules for RNA.
- Pasting several FASTA records at once. Many tools merge them into one sequence. In DNARev, turn on Each record separately to keep every record and its header.
Convert your own sequence in seconds.
Open the reverse complement tool