dN/dS Calculator

Calculate synonymous and nonsynonymous substitution rates to detect selection.

Substitution Data

Synonymous (Silent)

Nonsynonymous (Replacement)

Interpretation

  • omega < 1: Purifying selection
  • omega = 1: Neutral evolution
  • omega > 1: Positive selection

dN/dS Ratio (omega)

0.6589
omega = dN / dS
Weak purifying selection

Selection Analysis

Purifying Selection

Substitution Rates

dS (synonymous)0.051745
dN (nonsynonymous)0.034097

Raw Data

pS (proportion)0.050000
pN (proportion)0.033333
Syn. Rate (×10⁻⁹/yr)2587232.6808
Nonsyn. Rate (×10⁻⁹/yr)1704839.0279

What the Synonymous Substitution Calculator Does

The synonymous substitution calculator turns raw counts of DNA changes between two protein-coding sequences into a dN/dS ratio (also written omega, ω, or Ka/Ks) so you can detect the signature of natural selection. It is the same dN/dS calculation that molecular evolution researchers rely on, packaged so you can paste in five numbers and read the answer instantly.

A synonymous (silent) substitution changes a codon but not the amino acid it encodes, so it is largely invisible to selection on protein function. A nonsynonymous (replacement) substitution does change the amino acid and is therefore exposed to natural selection. By comparing how often each type of change happens — after correcting for the number of sites where each could happen — the calculator measures whether selection is removing protein-altering mutations, ignoring them, or actively favoring them.

This tool takes the number of synonymous sites (Ls) and nonsynonymous sites (Ln) in your alignment, the observed synonymous differences (Ds) and nonsynonymous differences (Dn), and the divergence time in millions of years. From those, the synonymous substitution calculator computes the proportions pS and pN, applies the Jukes-Cantor correction to recover dS and dN, divides them to get the dN/dS ratio, and reports a plain-language selection verdict.

The dN/dS Formula and Jukes-Cantor Correction

The calculator works in three stages. First it converts difference counts into observed proportions by dividing differences by the number of available sites:

  • pS = Ds / Ls — proportion of synonymous sites that differ
  • pN = Dn / Ln — proportion of nonsynonymous sites that differ

Raw proportions undercount real change because a single site can mutate more than once over deep time, hiding earlier substitutions. The Jukes-Cantor correction rescues those hidden multiple hits, converting the observed proportion p into the corrected number of substitutions per site d:

d = −(3/4) · ln(1 − (4/3) · p)

The calculator applies this separately to give dS (synonymous) and dN (nonsynonymous). The correction is only defined when the proportion is below 0.75; once p reaches 0.75 the logarithm explodes and the site is reported as Saturated, meaning so many changes have accumulated that the true distance can no longer be estimated reliably.

Finally the synonymous substitution calculator forms the headline ratio and an absolute rate:

  • omega (ω) = dN / dS — the selection signal
  • rate = d / (2T) — substitutions per lineage per unit time, where the factor of 2 accounts for change accumulating along both branches since the common ancestor

Corrected Substitution Distance and dN/dS

d = -0.75 × ln(1 - (4/3) × p), where p = D / L; omega = dN / dS

Where:

  • p= Observed proportion of differing sites (pS = Ds/Ls or pN = Dn/Ln)
  • D= Observed differences (synonymous Ds or nonsynonymous Dn)
  • L= Number of available sites (synonymous Ls or nonsynonymous Ln)
  • d= Jukes-Cantor corrected substitutions per site (dS or dN)
  • omega= dN/dS ratio; the selection indicator
  • T= Divergence time in millions of years, used in rate = d/(2T)

How to Interpret the dN/dS Ratio

The single most important number this calculator returns is omega. Its value relative to 1.0 tells you which evolutionary force is shaping your gene:

omega (dN/dS) Selection regime Biological meaning
< 0.1 Strong purifying Protein changes strongly removed; gene is highly conserved
0.1 – 0.5 Moderate purifying Most replacement mutations selected against
0.5 – 1 Weak purifying Some constraint, but relaxed
= 1 Neutral Replacement changes accumulate as fast as silent ones
> 1 Positive (Darwinian) Adaptive evolution actively favoring protein change

The calculator reports the verdict for you, but the intuition is simple: synonymous changes act as a built-in clock for the neutral mutation rate. If protein-altering changes are rarer than that clock predicts (omega < 1), selection is weeding them out. If they are just as common (omega = 1) the gene is evolving neutrally. If they are more common (omega > 1), something is rewarding novelty — a classic fingerprint of host-pathogen arms races, immune genes, and venom proteins.

Understanding Sites Versus Differences

The most common mistake when using any dN/dS calculator is confusing sites with differences. They are not the same thing, and the synonymous substitution calculator needs both.

Sites (Ls and Ln) describe the opportunity for each kind of change. Because of the structure of the genetic code, every codon is part synonymous and part nonsynonymous. A typical codon contributes roughly one synonymous site and two nonsynonymous sites, which is why a gene of 100 codons often yields around 100 synonymous and 300 nonsynonymous sites. These counts come from your alignment software (for example a counting method such as Nei-Gojobori).

Differences (Ds and Dn) are the changes you actually observed when you compared the two aligned sequences — how many synonymous positions and how many nonsynonymous positions differ between species A and species B.

Dividing differences by sites normalizes for opportunity. Without that normalization you would conclude that nonsynonymous change is always more common simply because there are more nonsynonymous sites. The proportions pS and pN level the playing field, and only then does the dN/dS ratio become a fair comparison of evolutionary pressure on silent versus protein-altering positions.

The fifth input, divergence time in millions of years, does not change omega at all — it only scales the absolute substitution rates. Two genes can share an identical dN/dS ratio yet evolve at wildly different speeds, and the rate output captures that difference.

Where dN/dS Analysis Is Used

The dN/dS framework computed by this synonymous substitution calculator is one of the workhorses of modern molecular evolution. Researchers and students use it across many domains:

  • Detecting adaptive evolution: Genes under positive selection (omega > 1) often sit at biological battlefronts — immune receptors, viral surface proteins, reproductive proteins, and toxins.
  • Identifying conserved genes: Housekeeping genes and core enzymes usually show strong purifying selection (omega well below 0.2), a useful sanity check when annotating new genomes.
  • Comparative genomics: Scanning thousands of orthologous gene pairs to find the handful evolving fastest at the protein level.
  • Virology and epidemiology: Tracking which sites of a viral protein are under pressure from host immunity or drug treatment.
  • Functional prioritization: Flagging candidate genes for experimental follow-up based on their selection signature.

Because the calculation here uses the Jukes-Cantor correction rather than ignoring multiple hits, it stays reasonable for moderately diverged sequences. For very deep divergences where the synonymous proportion approaches 0.75, the calculator honestly returns Saturated instead of a misleadingly precise number — a reminder that dS, the denominator of omega, has lost its power as a neutral clock and a more sophisticated maximum-likelihood model would be needed.

Assumptions and Limitations

Every dN/dS estimate carries assumptions, and knowing them keeps your conclusions honest. The Jukes-Cantor model used by this calculator assumes all four nucleotides occur at equal frequency and that every substitution type is equally likely. Real genomes violate this: transitions outnumber transversions, and GC content is rarely 50%. As a result, the simple correction can slightly underestimate true distances in biased genomes.

The calculator also reports a gene-wide average omega. A whole protein evolving under strong constraint can still hide a few positively selected sites; averaging dilutes them. If your gene-wide omega is near 1 but you suspect adaptation, site-specific or branch-specific likelihood models are the appropriate next step.

Statistical power matters too. With only a handful of differences, the dN/dS ratio is noisy and a single misaligned codon can swing the result. Longer sequences, accurate alignments, and codon-aware counting all improve reliability. Finally, the divergence-time input is only as good as the molecular clock or fossil calibration behind it; treat the absolute rates as approximate. Used with these caveats in mind, the synonymous substitution calculator is an excellent first-pass screen for selection.

Worked Examples

Default example: purifying selection

Problem:

A gene comparison gives Ls = 100 synonymous sites, Ln = 300 nonsynonymous sites, Ds = 5 synonymous differences, Dn = 10 nonsynonymous differences, over 10 million years of divergence. Find the dN/dS ratio.

Solution Steps:

  1. 1Proportions: pS = 5/100 = 0.050000 and pN = 10/300 = 0.033333.
  2. 2Jukes-Cantor synonymous: dS = -0.75 × ln(1 - (4/3)(0.05)) = 0.051745.
  3. 3Jukes-Cantor nonsynonymous: dN = -0.75 × ln(1 - (4/3)(0.033333)) = 0.034097.
  4. 4Ratio: omega = dN/dS = 0.034097 / 0.051745 = 0.6589.

Result:

omega = 0.6589, which the calculator classifies as weak purifying selection (protein change is somewhat suppressed).

Positive selection in a fast-evolving gene

Problem:

An immune gene shows Ls = 200, Ln = 600, Ds = 4 synonymous differences, Dn = 40 nonsynonymous differences, diverged 5 million years ago. Is it under positive selection?

Solution Steps:

  1. 1Proportions: pS = 4/200 = 0.020000 and pN = 40/600 = 0.066667.
  2. 2Corrected distances: dS = -0.75 × ln(1 - (4/3)(0.02)) = 0.020272 and dN = -0.75 × ln(1 - (4/3)(0.066667)) = 0.069818.
  3. 3Ratio: omega = 0.069818 / 0.020272 = 3.4441.
  4. 4Because omega is well above 1, replacement changes far outpace silent ones.

Result:

omega = 3.4441 — strong positive (Darwinian) selection, typical of immune or arms-race genes.

Neutral evolution

Problem:

A pseudogene-like region has Ls = 100, Ln = 100, Ds = 10, Dn = 10, over 20 million years. What does omega indicate?

Solution Steps:

  1. 1Proportions: pS = 10/100 = 0.100000 and pN = 10/100 = 0.100000 (identical).
  2. 2Corrected distances: dS = dN = -0.75 × ln(1 - (4/3)(0.1)) = 0.107326.
  3. 3Ratio: omega = 0.107326 / 0.107326 = 1.0000.
  4. 4Equal silent and replacement rates mean selection is not distinguishing the two.

Result:

omega = 1.0000 — neutral evolution; the protein is evolving as if free of functional constraint.

Saturated synonymous sites

Problem:

Two distantly related sequences give Ls = 100, Ds = 80, Ln = 300, Dn = 10. Why can't omega be computed?

Solution Steps:

  1. 1Synonymous proportion: pS = 80/100 = 0.800000.
  2. 2Because pS = 0.80 is greater than the 0.75 limit, the term 1 - (4/3)(0.80) is negative and the logarithm is undefined.
  3. 3The calculator therefore reports dS as 'Saturated' rather than a number.
  4. 4With no valid dS denominator, the dN/dS ratio is returned as N/A even though dN = 0.034097 is computable.

Result:

dS = Saturated, omega = N/A — the synonymous clock has lost its signal at this depth of divergence.

Tips & Best Practices

  • Always enter sites (Ls, Ln) and differences (Ds, Dn) separately — confusing them is the most common error.
  • Use codon-aware alignment software so frameshifts and gaps don't corrupt your site counts.
  • Read omega relative to 1.0: below 1 is purifying, equal to 1 is neutral, above 1 is positive selection.
  • Treat a 'Saturated' result as a warning that the sequences are too diverged for the Jukes-Cantor model.
  • Remember that gene-wide omega can hide a few positively selected sites within an otherwise conserved protein.
  • For very low difference counts, interpret the ratio cautiously — a single miscalled codon can swing the result.
  • Keep divergence time consistent in millions of years if you want comparable absolute substitution rates.
  • Cross-check striking omega values with a likelihood method such as PAML before drawing strong conclusions.

Frequently Asked Questions

A synonymous (silent) substitution changes a codon without changing the amino acid it encodes, thanks to redundancy in the genetic code. A nonsynonymous (replacement) substitution changes the amino acid and therefore the protein. Synonymous changes are largely neutral, while nonsynonymous changes are visible to natural selection.
Omega compares the rate of protein-altering change (dN) to the rate of silent change (dS), which serves as a neutral baseline. A value below 1 means protein change is being suppressed by purifying selection, exactly 1 means neutral evolution, and above 1 signals positive selection favoring amino-acid change. It is the standard summary of selective pressure on a gene.
Over time a single nucleotide site can mutate more than once, so raw difference counts undercount the true number of substitutions. The Jukes-Cantor correction, d = -0.75 × ln(1 - (4/3)p), statistically recovers those hidden multiple hits to give a more accurate distance. Without it, dN and dS would be biased downward, especially for diverged sequences.
Saturation appears when the observed proportion of differing sites reaches or exceeds 0.75. At that point the Jukes-Cantor logarithm becomes undefined and the true distance can no longer be estimated, because the sites have changed so many times that the original signal is lost. It usually means the sequences are too distantly related for this simple model, and dN/dS cannot be trusted.
No. Omega is a ratio of two rates measured over the same period, so the time term cancels out and divergence time does not affect it. Divergence time only scales the absolute substitution rates (rate = d/2T), letting you compare how fast different genes evolve in real time even when their dN/dS ratios are identical.
Site counts come from a codon-aware counting method applied to your alignment, such as the Nei-Gojobori approach implemented in tools like MEGA, PAML, or Biopython. As a rough rule, each codon contributes about one synonymous and two nonsynonymous sites, so a 100-codon gene yields roughly 100 synonymous and 300 nonsynonymous sites.

Sources & References

Last updated: 2026-06-05

💡

Help us improve!

How would you rate the dN/dS Calculator?

<>

Editorial Note

MyCalcBuddy Editorial Team

This page is maintained as an educational calculator reference.

Source

Formula Source: Standard Mathematical References

by Various

UpdatedLast reviewed: May 2026
CheckedFormula checks are based on standard references and internal QA review.

Privacy choices

MyCalcBuddy uses necessary storage for the site to work. Optional analytics, notifications, and future advertising features stay off unless you allow them.