Pairwise Sequence Alignment Online Tool (Needleman-Wunsch Global Alignment)
Needleman-Wunsch is the standard algorithm for global alignment, using dynamic programming to guarantee the optimal alignment under a given scoring scheme — not a heuristic approximation.
The algorithm rests on a single recurrence. Let H(i,j) be the optimal score for the first i residues of sequence a and the first j residues of sequence b:
H(i,j) = max{ H(i-1,j-1) + s(aᵢ,bⱼ), align
H(i-1,j) + gap, gap in b
H(i,j-1) + gap } gap in a
Once the matrix is filled, trace back from the bottom-right corner to recover the alignment.
Global or local? This is the most common source of errors:
- Global alignment (this tool): forces both sequences to be aligned end-to-end. Best for sequences of similar length with high overall homology — e.g., two alleles of the same gene, or a plasmid fragment before and after cloning.
- Local alignment (Smith-Waterman / BLAST): finds only the most similar region. Use this when sequences differ greatly in length or share homology only over a subset of positions. Comparing a short primer against a long template with global alignment will give a result swamped by gaps.
Scoring parameters change the result. The defaults (match +1, mismatch −1, gap −2) are adequate for a quick look. For formal analysis, use a tool with a substitution matrix (EDNAFULL for nucleotides, BLOSUM62 for proteins) and separate gap-open and gap-extend penalties — this tool uses a linear gap penalty, which can give substantially biased results for sequences containing long insertions or deletions.
Computation runs entirely in the browser; time and space are both O(mn), so sequence length is capped at 2000 bp.
FAQ
Which should I use — global or local alignment?
Use global alignment (this tool) when sequences are similar in length with high overall homology. Use local alignment (Smith-Waterman / BLAST) when they differ greatly in length or share homology only over part of their length. Comparing a short primer against a long template with global alignment will produce a result swamped by gaps.
Why does the identity percentage differ from other tools?
Identity can be calculated with two different denominators: total alignment length (including gaps) or the length of the shorter sequence. This tool uses total alignment length. Different scoring schemes also produce different alignments and therefore different identity values.
What is the maximum sequence length?
2000 bp. Dynamic programming is O(mn) in both time and space; longer sequences will freeze the browser.
Related tools
Codon Table Quick Reference (Standard Genetic Code): Bidirectional Codon–Amino Acid Lookup
All 64 codons of the standard genetic code — look up amino acids by codon or reverse-query codons by amino acid; accepts both DNA and RNA notation.
Amino Acid Properties Reference: Molecular Weight, Side-Chain pKa, Hydrophobicity, and Codon Count
Properties of all 20 standard amino acids: residue mass, side-chain pKa, Kyte-Doolittle hydrophobicity, and codon count. Searchable by code or name.
Restriction Enzyme Recognition Sequences Reference & Cut-Site Finder
Recognition sequences, cut sites, end types, and average spacing for 30 common restriction enzymes; paste any sequence to locate cut sites (linear or circular).
Buy me a coffee