Paste two DNA, RNA or protein sequences to align them with the Needleman–Wunsch (global) or Smith–Waterman (local) algorithm. Choose BLOSUM62 or match/mismatch scoring and affine gap penalties, then read the identity, similarity, gaps and score, with the full dynamic programming matrix for short sequences.
Last updated:
Examples:
Alignment
Alignment
| identical: similar (positive score). mismatch- gap
Dynamic programming score matrix
Best score in each cell; highlighted cells are the traceback path.
Advertisement
Advertisement
How to use the Pairwise Sequence Alignment Tool
Paste the two sequences into the A and B boxes. FASTA headers are used as names; spaces, numbers and dashes are ignored.
Choose global or local. Global aligns the sequences end to end; local finds the best-matching region.
Set the scoring. Auto uses match 5 / mismatch −4 for DNA and BLOSUM62 for protein; gap open 10 and extend 0.5 are common defaults.
Read the summary: identity, similarity, gaps, score and the aligned coordinates.
Check the alignment view, and for short sequences the score matrix with the traceback path, then copy or download the result.
How the alignment algorithms work
Both algorithms fill a dynamic programming matrix where cell (i, j) holds the best score for aligning the first i residues of A with the first j residues of B. Each cell is reached by a diagonal step (align Ai with Bj and add their substitution score), a vertical step (Ai against a gap) or a horizontal step (Bj against a gap). The tool uses Gotoh's three-matrix version so that opening a gap and extending it can cost different amounts.
Needleman–Wunsch (global): the first row and column hold the cost of leading gaps, and the answer is in the bottom-right cell. Tracing back from there gives an end-to-end alignment.
Smith–Waterman (local): any cell can restart at 0, so negative stretches are dropped. The answer is the highest cell anywhere in the matrix, and the traceback stops where the score returns to 0.
Try the textbook example GCATGCG / GATTACA with match +1, mismatch −1 and a gap cost of 1 (open 1, extend 1). The global score is 0, and the score matrix shows the traceback path.
Recommended settings
Task
Mode
Scoring
Gap open / extend
Two versions of the same gene
Global
Match 5, mismatch −4
10 / 0.5
Homologous proteins of similar length
Global
BLOSUM62
10 / 0.5 (or 11 / 1)
Find a domain or motif inside a longer protein
Local
BLOSUM62
10 / 0.5
Short read or primer against a reference
Local, or global with free end gaps
Match 5, mismatch −4
10 / 0.5
Learning the algorithm by hand
Global
Match 1, mismatch −1
1 / 1 (linear gap −1)
Reading the result
| (green) identical residues, : (yellow) different but similar residues (positive BLOSUM62 score), . mismatches and - gaps.
As a rough guide, protein pairs above about 30–35% identity over a long alignment are very likely homologous, while values around 20–25% are a "twilight zone" that needs other evidence.
The score depends on the scoring system, so compare scores only between alignments made with the same settings.
What is the difference between global and local alignment?
Global alignment (Needleman–Wunsch) aligns both sequences over their entire length and is best for sequences of similar length that are related all the way through. Local alignment (Smith–Waterman) finds the highest-scoring matching region and ignores the rest, which suits a domain inside a larger protein or a short read inside a longer sequence.
How is percent identity calculated?
Identity = identical aligned columns ÷ total alignment columns × 100, where the total includes gap columns. This matches the convention of EMBOSS needle and water. Other tools sometimes divide by the length of the shorter sequence, so numbers can differ.
What does similarity mean?
Similarity counts identical pairs plus pairs with a positive substitution score. With BLOSUM62, conservative swaps such as isoleucine to valine (score 3) or aspartate to glutamate (score 2) count as similar and are marked with a colon in the alignment.
How are gap penalties applied?
A gap of length k costs open + (k − 1) × extend. With open 10 and extend 0.5 a 1-residue gap costs 10 and a 5-residue gap costs 12. This affine scheme, solved with the Gotoh algorithm, prefers one long gap over many short ones, which matches how insertions and deletions usually occur.
What are free end gaps?
With free end gaps, gaps before the first or after the last residue of either sequence cost nothing. Use it when one sequence is a fragment of the other or the two only overlap at their ends, such as sequencing reads.
How long can the sequences be?
Up to about 25 million matrix cells, for example two sequences of 5,000 residues, depending on your device. The full score matrix is displayed only when both sequences are 40 residues or shorter.
Are my sequences uploaded?
No. The alignment is computed with JavaScript in your browser and nothing is sent to a server.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.