DNA Codon Calculator
A DNA codon calculator reads a DNA or mRNA sequence three bases at a time and looks each triplet up in the standard genetic code to give the amino acid sequence it encodes. It is used by molecular biology students learning the central dogma, by bench scientists verifying open reading frames after a cloning step, by bioinformaticians sanity-checking a translation produced by a longer pipeline, and by synthetic biologists designing codon-optimised genes. The tool also returns GC content, an estimated molecular weight, and the reverse complement on demand, three things you typically need at the same time when working with a sequence.
The standard genetic code is universal in biology. Sixty-one codons encode twenty amino acids, and three codons (TAA, TAG, TGA) tell the ribosome to stop. ATG encodes methionine and doubles as the start signal. Every protein in every cell that has ever been sequenced is built from this same 64-codon lookup. This calculator implements NCBI translation table 1 exactly, in your browser, with no upload and no server call.
How to Use the DNA Codon Calculator
- Paste or type a sequence into the input box. The sequence can be raw bases, FASTA-formatted (a
> header line is stripped), or include digits and whitespace (digits and whitespace are stripped). Lowercase or uppercase both work. - Pick the alphabet mode. Auto-detect (the default) figures out whether you have DNA (A/C/G/T) or mRNA (A/C/G/U) by looking at the first ambiguous base. If you want to force a mode, pick DNA or mRNA explicitly.
- Read the result panel. It shows the amino acid sequence in 1-letter code, with start codons (ATG) marked green and stop codons (TAA/TAG/TGA) marked red. Below that is a codon-by-codon table, the GC content percentage, and the molecular weight in daltons.
- Click "Show reverse complement" to see the antisense strand. This is useful when you have the coding strand and want the template strand, or when you want to translate a sequence given in the reverse direction.
- Copy the amino acid sequence to your clipboard, or paste it into the sister Protein Molecular Weight calculator for a more detailed mass calculation.
The calculator handles case-insensitive input, strips whitespace, digits, and FASTA headers, and rejects ambiguous bases (N, Y, R, W, S, K, M, B, D, H, V) with a clear error mentioning the offending character. If your sequence contains both T and U, the calculator asks you to pick a single alphabet.
The calculator does three things: it translates the sequence, computes GC content, and estimates molecular weight. All three are deterministic and run entirely in your browser.
Translation (codon โ amino acid). The sequence is split into non-overlapping triplets starting from the 5โฒ end. Each triplet is looked up in the NCBI standard codon table (translation table 1). Valid bases are A, C, G, and T (or U for mRNA). The lookup returns one of twenty amino acid 1-letter codes, or * for stop codons. The reading frame is fixed at frame 1 (the calculator does not search for ORFs across frames, for that, use a dedicated ORF-finder). Trailing 1- or 2-base fragments that do not form a complete codon are dropped with a warning.
GC content. GC content is the fraction of bases that are guanine or cytosine, expressed as a percentage:
GC % = (G + C) / length ร 100
The formula treats U as T for RNA inputs (U pairs with A in the same way T does, so GC content is the same for an RNA and its parent DNA coding strand). GC content is reported to two decimal places.
Molecular weight. The molecular weight is estimated from the standard average residue mass table, the same convention used by the Protein Molecular Weight calculator and by ExPASy ProtParam. The formula is:
MW = ฮฃ(residue masses) โ (n โ 1) ร 18.015
where n is the number of amino acid residues (stop codons contribute 0 and are not counted in n) and 18.015 Da is the mass of the water lost each time a peptide bond forms. The result is in daltons (equivalent to g/mol for a single molecule).
Reverse complement. The reverse complement is computed by swapping AโT and CโG, then reversing the order. This is the antisense strand of the input, read 5โฒโ3โฒ. It is the operation a ribosome effectively performs when given a template strand directly.
Worked Examples
Example 1, A minimal gene fragment. The sequence ATGGCATTGGCCAAATTT is a short reading frame of six codons. Starting at the 5โฒ end:
ATG โ Methionine (M, start)GCA โ Alanine (A)TTG โ Leucine (L)GCC โ Alanine (A)AAA โ Lysine (K)TTT โ Phenylalanine (F)
The amino acid sequence is M A L A K F. There is no stop codon, so if this were a complete gene, it would encode a 6 amino acid peptide with no termination signal. The calculator marks the leading ATG green and reports a GC content of 8/18 = 44.4%. The molecular weight is approximately 663 Da (sum of residues minus 5 ร 18.015).
Example 2, A gene with a stop codon. The sequence ATGAAACACTGA is a 12-base reading frame used in textbook examples of the stop codon TGA:
ATG โ Methionine (M, start)AAA โ Lysine (K)CAC โ Histidine (H)TGA โ Stop (*)
The amino acid sequence is M K H *. The calculator marks the ATG green and the TGA red. This is the canonical pattern of a minimal gene: a start codon, an arbitrary number of coding codons, then a stop codon. The molecular weight is computed for the three amino acids K, H, M only (โ 436 Da).
Example 3, Reverse complement. Given the coding strand ATGGCATTGGCC, the antisense strand (template strand) is its reverse complement. Swap AโT, CโG to get TACCGTAACCGG, then reverse to get GGCCAATGCCAT. This is the sequence the ribosome would read if the original strand were the template strand.
Example 4, GC content extremes. A 60-base sequence of 30 G's followed by 30 C's has a GC content of 100%. A 60-base sequence of all A's has a GC content of 0%. The calculator reports both to two decimal places. GC content is widely used as a proxy for several biological properties: PCR primer design (primers with very high or very low GC content are harder to use), genome complexity (bacterial genomes vary from about 25% to 75% GC), and thermostability of DNA duplexes (higher GC means more hydrogen bonds per base pair and a higher melting temperature).
Example 5, mRNA mode. The same calculator handles mRNA by replacing U with T internally before the lookup. The mRNA AUGGCCAAGGUCGAAUUC translates to M A K V E F, identical to the DNA version ATGGCCAAGGTCGAATTC. This is the same 6-codon reading frame used in the test cases; it is the first six codons of the human ฮฒ-globin reference coding sequence.
The Standard Genetic Code
The genetic code is a lookup table mapping 64 three-base combinations to 20 amino acids plus three stop signals. The mapping is "degenerate" in Crick's original sense: most amino acids are encoded by more than one codon. Leucine, arginine, and serine each have six codons; methionine and tryptophan have one. The redundancy is not random, codons that differ in the third position (the "wobble" position) tend to encode the same amino acid, which gives the cell some tolerance for sequencing errors and mismatches.
The standard code (NCBI translation table 1) is used by almost every organism on Earth. The few exceptions are mitochondrial genomes, a handful of protozoa, and some chloroplasts, which use slightly different translation tables (table 2 for vertebrate mitochondria, table 6 for Ciliata, and so on). This calculator uses the standard nuclear code throughout, which is correct for any gene from E. coli, yeast, human, plant, or animal.
Start codons. ATG is the standard start codon. A few organisms use alternative starts (GTG, TTG, ATT) at low frequency, and bacterial genes sometimes use GUG as a start in translation initiation, but the codon table itself only assigns M to ATG. The calculator marks ATG in green where it appears in the input.
Stop codons. TAA, TAG, and TGA are the three stop codons. They are often called ochre, amber, and opal (or umber) respectively, after the historical colour-coding used by early genetics labs. None of them encode an amino acid; instead, release factors bind to the ribosome when they encounter a stop codon and trigger peptide release. The calculator marks all three in red.
Degeneracy. Because 61 codons encode 20 amino acids, the code is degenerate by a factor of about three. The degeneracy is mostly in the third position: GCN all encode Alanine, GGN all encode Glycine, and so on. This is why synonymous mutations (changes that alter the codon but not the amino acid) are common and why synonymous site evolution is a key signal in molecular evolution studies.
Common Mistakes
Mistake 1, Off-by-three frameshifts. The DNA codon calculator reads in frame 1 starting at the 5โฒ end. If your sequence accidentally includes a 1- or 2-base indel relative to the biological reading frame, the entire translation after the indel is wrong. The calculator warns you when it drops trailing bases that did not form a complete codon, but it cannot detect internal indels. If your output looks nonsensical, double-check that the input length is a multiple of three from the actual start of the gene.
Mistake 2, Using the wrong strand. DNA is double-stranded. The strand you sequence, the strand in a FASTA file, and the strand the gene actually uses as its template can all be different. If your translation produces no start codon and a wall of stops, try the reverse complement. The calculator's reverse-complement button is the one-button way to fix this.
Mistake 3, Including 5โฒ UTRs or 3โฒ UTRs in the translation. Untranslated regions are part of the mRNA but they do not contribute to the protein. If you paste a full mRNA sequence including its 5โฒ and 3โฒ UTRs, the calculator will translate the whole thing and produce a meaningless amino acid string at the start and end. Trim the input to the coding sequence (CDS), from the first ATG to the first in-frame stop codon, before translating.
Mistake 4, Treating U and T as equivalent when they are not. In a real DNA sequence, every base is A, C, G, or T. In a real mRNA sequence, every base is A, C, G, or U. If you copy a sequence from a tool that uses one alphabet and paste it into a calculator that expects the other, you will get a wrong translation. The auto-detect mode handles this, but if you know your input alphabet, force the mode explicitly to avoid ambiguity.
Mistake 5, Confusing the molecular weight here with the protein-only calculator. The molecular weight computed in this calculator is derived from the translated 1-letter amino acid sequence using the standard average residue mass table. If you translate a sequence that contains ambiguous bases (which the calculator rejects) or if you include non-standard amino acids (selenocysteine, pyrrolysine, post-translational modifications), the result will be off. For a more detailed mass calculation, take the amino acid output and feed it into the Protein Molecular Weight calculator, which provides the same estimate with a more detailed downstream view.
Frequently Asked Questions
What is the standard genetic code? The standard genetic code is the nearly universal mapping by which 64 three-base codons in DNA or mRNA are translated into 20 amino acids and three stop signals. It is sometimes called the "canonical" or "universal" code, although a small number of organisms use minor variants in their mitochondria or chloroplasts. The NCBI standard genetic code (translation table 1) is the reference used by this calculator and is correct for nuclear genes in virtually all organisms.
What is the difference between DNA and mRNA mode? DNA mode accepts the four bases A, C, G, and T. mRNA mode accepts A, C, G, and U instead of T. Internally the calculator normalises both to the same lookup table by replacing U with T before the codon lookup, so the result is identical for a sequence that is the same in both alphabets. The auto-detect mode picks the alphabet based on which non-AC-G base your sequence contains.
What does GC content mean? GC content is the fraction of bases in a DNA or RNA sequence that are guanine or cytosine, expressed as a percentage. It ranges from 0% (an all-AT sequence) to 100% (an all-GC sequence). GC content is widely used as a proxy for several biological properties: PCR primer design (primers with very high or very low GC content are harder to use), genome complexity (bacterial genomes vary from about 25% to 75% GC), and thermostability of DNA duplexes (higher GC means more hydrogen bonds per base pair and a higher melting temperature).
How is the molecular weight calculated? The molecular weight is the sum of the average residue masses of the amino acids in the translated sequence, minus (n โ 1) ร 18.015 Da, where n is the number of amino acid residues and 18.015 Da is the mass of the water lost when each peptide bond forms. Stop codons do not contribute to the mass and are not counted in n. The same convention is used by ExPASy ProtParam and the standard residue mass table.
What does the reverse complement do? The reverse complement is the antisense strand of your input, read in the 5โฒโ3โฒ direction. It is computed by swapping AโT and CโG, then reversing the order. The reverse complement is the strand the ribosome reads when the original strand is the template strand, and it is also the strand you want to use as a PCR primer if you are amplifying the opposite direction. Many molecular biology operations require the reverse complement, and calculating it by hand is error-prone for sequences longer than a few dozen bases.
Can the calculator handle very long sequences? Yes. The calculator runs entirely in the browser, so the limiting factor is the JavaScript engine's string-handling speed rather than any server-side constraint. In practice, sequences of up to about 100,000 bases translate in well under a second on a modern laptop. For genome-scale analysis (millions of bases), use a dedicated bioinformatics tool such as EMBOSS transeq, ExPASy Translate, or a Biopython script.
Why does the calculator reject N, Y, R, and other ambiguous bases? The standard genetic code is defined only for the four canonical bases (A, C, G, T or U). Symbols like N (any), Y (C or T), R (A or G), W (A or T), S (G or C), K (G or T), M (A or C), B (not A), D (not C), H (not G), and V (not T) come from the IUPAC notation for partially specified bases. They are useful when you have sequencing data that cannot resolve a base, but they cannot be unambiguously translated without knowing which underlying base is meant. The calculator rejects them so that every output is unambiguous.
Is the result the same as ExPASy Translate or Benchling? Yes, for the standard genetic code and clean (non-ambiguous) input sequences, the result is identical. All three tools use the same NCBI translation table 1 and the same reading-frame convention (5โฒโ3โฒ starting at the first base). The differences are in the surrounding tooling: ExPASy Translate offers additional options like choosing variant translation tables, Benchling offers a full gene-design workflow, and this calculator offers an interactive codon-by-codon breakdown with GC content and molecular weight in one panel.
How does this relate to the Protein Molecular Weight calculator? The two calculators are complementary. Use this DNA Codon Calculator when you have a DNA or mRNA sequence and want to know what protein it encodes. Use the Protein Molecular Weight calculator when you already have an amino acid sequence and want a detailed mass calculation including parameters such as extinction coefficient, isoelectric point, and instability index. If you have a DNA sequence, the cleanest workflow is to translate it here, then paste the resulting amino acid sequence into the protein molecular weight calculator for a richer downstream analysis.
What does the start codon do? In a real cell, the start codon (ATG) does more than encode methionine, it positions the ribosome at the correct reading frame and triggers translation initiation. The calculator marks ATG in green wherever it appears in the input, but it does not attempt to identify the actual start of a gene, because that requires promoter and ribosome-binding-site information that is not present in a raw DNA sequence. If you have a full mRNA, the first ATG in the mRNA is usually the start of the coding sequence.
References
- National Center for Biotechnology Information (NCBI). Genetic Codes, Translation Tables. https://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi
- NIH National Human Genome Research Institute. Genetics Home Reference, Genetic Code. https://ghr.nlm.nih.gov/primer/howgeneswork/genecode
- Crick, F. H. C. (1958). On protein synthesis. Symposia of the Society for Experimental Biology, 12, 138 to 163. (The central dogma of molecular biology.)
- Watson, J. D., & Crick, F. H. C. (1953). Molecular structure of nucleic acids: A structure for deoxyribose nucleic acid. Nature, 171, 737 to 738.
- Alberts, B., Johnson, A., Lewis, J., Raff, M., Roberts, K., & Walter, P. (2002). Molecular Biology of the Cell (4th ed.). Garland Science. (Chapter 6: How Cells Read the Genome.)
- Lodish, H., Berk, A., Kaiser, C. A., Krieger, M., Bretscher, A., Ploegh, H., Amon, A., & Martin, K. C. (2016). Molecular Cell Biology (8th ed.). W. H. Freeman. (Chapter 4: Molecular Genetic Mechanisms.)
- ExPASy, Swiss Bioinformatics Resource Portal. Translate tool. https://web.expasy.org/translate/
- IUPAC, International Union of Pure and Applied Chemistry. Nomenclature for incompletely specified bases in nucleic acid sequences. (IUPAC-IUB Joint Commission on Biochemical Nomenclature, 1985.)