Sequence Alignment Tool
Paste two DNA, RNA or protein sequences and align them globally (Needleman–Wunsch) or locally (Smith–Waterman). Choose a BLOSUM or PAM matrix or your own match and mismatch scores, set affine gap penalties, and get the score, percent identity and similarity, gap counts and a numbered alignment you can copy. For short sequences you can also see the scoring matrix with the best path marked. It runs in your browser; nothing is uploaded.
Only the first FASTA record of each box is used. Spaces, line breaks and numbers are ignored.
Scoring
Treated as protein.
Enter penalties as positive numbers. A gap of length k costs open + (k − 1) × extension; set both equal for a linear gap penalty.
Results
292.5
Alignment score
65/149 (43.6%)
Identity
90/149 (60.4%)
Similarity
9/149 (6%)
Gaps
149
Alignment length
Alignment
HBA_HUMAN 1 MV-LSPADKTNVKAAWGKVGAHAGEYGAEALERMFLSFPTTKTYFPHF-DLS-----HGS 53
|| |:|.:|:.|.|.|||| :..|.|.|||.|:.:.:|.|:.:|..| ||| .|:
HBB_HUMAN 1 MVHLTPEEKSAVTALWGKV--NVDEVGGEALGRLLVVYPWTQRFFESFGDLSTPDAVMGN 58
HBA_HUMAN 54 AQVKGHGKKVADALTNAVAHVDDMPNALSALSDLHAHKLRVDPVNFKLLSHCLLVTLAAH 113
.:||.|||||..|.::.:||:|::....:.||:||..||.|||.||:||.:.|:..||.|
HBB_HUMAN 59 PKVKAHGKKVLGAFSDGLAHLDNLKGTFATLSELHCDKLHVDPENFRLLGNVLVCVLAHH 118
HBA_HUMAN 114 LPAEFTPAVHASLDKFLASVSTVLTSKYR 142
...||||.|.|:..|.:|.|:..|..||.
HBB_HUMAN 119 FGKEFTPPVQAAYQKVVAGVANALAHKYH 147| identical · : similar (positive score) · . different · blank = gap. One of the best alignments is shown; others may tie.
Available for short sequences with a linear gap penalty (open = extension).
How to Use the Sequence Alignment Tool
- 1. Paste both sequences. Plain letters or FASTA; the first record in each box is used. The tool detects DNA or protein, and you can override it.
- 2. Choose global or local. Global aligns the sequences end to end and suits two sequences of similar length that you expect to be related throughout. Local finds the best-matching region and suits a short sequence inside a long one or two proteins that share only a domain.
- 3. Set the scoring. For protein pick a substitution matrix; for DNA set the match and mismatch scores. Set the gap open and extension penalties as positive numbers.
- 4. Read the result. The score, identity, similarity and gaps appear above a numbered alignment in blocks of 60 columns. Copy it as plain text for a report.
How the Algorithms Work
Both methods fill a grid in which each cell holds the best score of any alignment ending at that pair of positions, building on the three neighbouring cells — a match or mismatch from the diagonal, or a gap from above or from the left. Needleman–Wunsch (1970) fills the whole grid and reads the answer from the bottom-right corner, so it aligns both sequences completely. Smith–Waterman (1981) never lets a score fall below zero, so a poor stretch simply restarts the alignment, and the answer is the highest cell anywhere in the grid. Gap costs follow Gotoh (1982): a gap of length k costs open + (k − 1) × extension, so one long gap is cheaper than several short ones, which is how insertions and deletions behave in real genes. Setting the two penalties equal gives the textbook linear gap penalty.
| Setting | Use it for | Typical values |
|---|---|---|
| BLOSUM62 | General protein comparison; the default of BLAST | Gap open 10–11, extension 0.5–1 |
| BLOSUM45 | Distantly related proteins | Gap open 10–15 |
| BLOSUM80 | Close relatives with high identity | Gap open 10 |
| PAM250 | Very distant homologues, older evolutionary model | Gap open 10 |
| DNA match/mismatch | Nucleotide alignment: +5 / −4 mirrors EMBOSS Needle's DNA matrix; +1 / −1 is the textbook scheme | Gap open 10, extension 0.5 |
The BLOSUM matrices (Henikoff and Henikoff, 1992) score each pair of residues by how often it occurs in conserved blocks of related proteins, and the number is the clustering threshold: BLOSUM62 was built from blocks clustered at 62% identity. PAM matrices (Dayhoff and colleagues, 1978) extrapolate from observed point mutations, and PAM250 corresponds to 250 mutations per 100 residues. The tool uses the NCBI versions of all four. Its scores match Biopython's PairwiseAligner for global and local mode, DNA and protein, across a range of gap penalties.
Worked Example: Human Alpha- and Beta-Globin
Example: human α- and β-globin loads the two haemoglobin subunits (UniProt P69905, 142 residues, and P68871, 147 residues). They descend from a common ancestor but diverged long ago, so they are a good test of an aligner. With BLOSUM62 and gap penalties of 10 and 0.5, the global alignment scores 292.5 over 149 columns.
| Statistic | Value | Meaning |
|---|---|---|
| Identity | 65/149 (43.6%) | Columns with the same residue |
| Similarity | 90/149 (60.4%) | Identical columns plus those with a positive BLOSUM62 score |
| Gaps | 9/149 (6.0%) | Nine gap columns in four gaps, which absorb the length difference of 142 and 147 residues |
| Local score | 293.5 | Residues 3–141 of α against 4–146 of β; trimming the ends gains one point |
Identity here is counted over the alignment length, gaps included, as EMBOSS Needle does; some tools divide by the length of the shorter sequence instead, which gives a higher figure, so always compare like with like. Load a textbook DNA pair to see the same machinery on GCATGCG and GATTACA with +1 / −1 / −1 scoring: the global score is 0 and the local score is 2 (the shared CA), and ticking Show the scoring matrix draws the grid with the best path shaded.
Limits to Keep in Mind
- One optimal alignment. Several alignments can tie for the best score; the tool shows one of them. The score is exact either way.
- Pairwise only. It aligns two sequences, not a family, and does not search a database. Use BLAST for that.
- Size. The product of the two lengths must stay under 12 million, about 3,400 × 3,400 residues.
- Score is not significance. A score depends on the matrix and penalties, and says nothing about whether the match could arise by chance. BLAST reports E-values for that.
Frequently Asked Questions
- What is the difference between global and local alignment?
- Global alignment (Needleman–Wunsch) forces both sequences to be aligned from end to end, which is right when they are similar throughout. Local alignment (Smith–Waterman) reports only the best-scoring region and ignores unrelated ends, which is right when only part of the sequences is related, such as a shared domain or a primer inside a longer template.
- How do I read the lines of symbols between the sequences?
- A vertical bar marks an identical pair, a colon a similar protein pair (positive substitution score), a dot a different pair, and a blank a gap. The numbers at the sides count the residues of each sequence, so you can locate any block in the original.
- Which scoring matrix should I choose?
- BLOSUM62 is the standard default for protein. Use BLOSUM80 for close relatives and BLOSUM45 for distant ones; a lower number tolerates more divergence. PAM250 is the older alternative for distant sequences. For DNA, choose match and mismatch scores whose ratio reflects how similar you expect the sequences to be.
- How do gap open and extension penalties work?
- The first position of a gap costs the open penalty and each further position costs the extension penalty, so a gap of length k costs open + (k − 1) × extension. A large open penalty with a small extension discourages many separate gaps but allows long ones. Setting the two equal makes every gap position cost the same.
- What percent identity means two proteins are related?
- As a rough rule, over 100 or more residues, an identity above about 30% usually indicates shared ancestry, while 20–25% falls in a "twilight zone" where chance matches become common and a significance test is needed. The figure depends on alignment length, so a high identity over ten residues proves little.
- Can I align more than two sequences or search a database?
- No. This tool does pairwise alignment only. Multiple sequence alignment programs and database searches such as BLAST use heuristics designed for many sequences or very large databases.