Home › Text Tools › Pairwise Sequence Alignment Tool

Pairwise Sequence Alignment Tool

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
Advertisement
Advertisement

How to use the Pairwise Sequence Alignment Tool

  1. Paste the two sequences into the A and B boxes. FASTA headers are used as names; spaces, numbers and dashes are ignored.
  2. Choose global or local. Global aligns the sequences end to end; local finds the best-matching region.
  3. 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.
  4. Read the summary: identity, similarity, gaps, score and the aligned coordinates.
  5. 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

TaskModeScoringGap open / extend
Two versions of the same geneGlobalMatch 5, mismatch −410 / 0.5
Homologous proteins of similar lengthGlobalBLOSUM6210 / 0.5 (or 11 / 1)
Find a domain or motif inside a longer proteinLocalBLOSUM6210 / 0.5
Short read or primer against a referenceLocal, or global with free end gapsMatch 5, mismatch −410 / 0.5
Learning the algorithm by handGlobalMatch 1, mismatch −11 / 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.
  • To compare a gene with a protein, translate it first with the DNA to Protein Translator.

Frequently asked questions

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.

Related tools

DNA to Protein TranslatorTranslate DNA or RNA into protein in all six reading frames with stop codons highlighted.ORF FinderFind open reading frames in all 6 frames of a DNA sequence, with positions, lengths and protein translations.Protein Molecular Weight CalculatorProtein MW in Da/kDa from an amino acid sequence, plus pI, extinction coefficient and composition.DNA Reverse ComplementGet the reverse, complement or reverse complement of DNA/RNA, FASTA and IUPAC codes supported.Online Word ProcessorFree browser word processor with headings, lists, tables and images. Autosaves; export DOCX or PDF.Remove Line BreaksStrip line breaks and extra spaces, keep paragraphs if you want.Sort Lines AlphabeticallySort a list A-Z, Z-A, numerically, naturally or by length, or shuffle it.Case ConverterConvert text to UPPERCASE, lowercase, Title Case, camelCase and more.MLA Format GeneratorBuild an MLA 9 heading, title page layout and Works Cited entries.Lorem Ipsum GeneratorGenerate placeholder text as paragraphs, words or lists, with HTML.Text RepeaterRepeat any text or emoji up to 100,000 times with custom separators.Find and Replace TextFind and replace words or regex patterns in any text, with match highlighting and undo.Add Line NumbersNumber every line of your text with custom start, step, padding and separator, or remove numbers.Add Prefix and Suffix to LinesAdd text to the start and end of every line: quotes, commas, bullets or SQL lists.Comma SeparatorTurn a column of lines into a comma separated list and back, with any delimiter.Text to Handwriting ConverterTurn typed text into realistic handwriting on notebook paper and save it as PNG or PDF.Japanese Kana ConverterConvert romaji to hiragana or katakana, kana to romaji, and hiragana to katakana instantly.Pinyin Tone ConverterTurn pinyin tone numbers (ni3 hao3) into tone marks (nǐ hǎo), or tone marks back into numbers.Remove Duplicate LinesDelete duplicate lines from any list, ignoring case or spaces, keep first or last, and sort.Remove Extra SpacesClean up double spaces, tabs, blank lines, non-breaking and invisible spaces in one click.Random Word GeneratorGenerate random English words by type, length, first letter and syllables, then copy them.List RandomizerShuffle a list into random order, pick random items or split it into fair teams.Email ExtractorPull every unique email address out of text or files, sort, filter by domain and export CSV.URL ExtractorExtract every link from text or HTML, remove duplicates, filter by domain or protocol.Strip HTML TagsRemove HTML tags and get clean plain text with line breaks and decoded entities.Online NotepadPrivate notepad that autosaves notes in your browser, with find, word count and .txt download.Remove PunctuationStrip all or only selected punctuation from text, with smart options for apostrophes and numbers.Text SplitterSplit long text into chunks by characters, words, lines or a delimiter, with numbering and copy.Remove AccentsStrip accents and diacritics from text (é→e, ñ→n, ß→ss, ø→o) instantly, live as you type.Sort NumbersPull numbers out of any text and sort them ascending or descending, with sum, average and median.Thread SplitterSplit long text into numbered X, Threads, Bluesky or Mastodon posts at sentence boundaries.Duplicate Word FinderFind repeated words in your text: doubled words like "the the" and overused words, highlighted.Alternating Caps GeneratorTurn text into aLtErNaTiNg caps, random caps or alternating words, then copy it.Random Paragraph GeneratorGenerate readable random English paragraphs by topic and length for writing and design.Random Sentence GeneratorGenerate random grammatical sentences: simple, compound, complex and questions.Markdown to Plain TextStrip Markdown syntax and keep clean plain text with lists, line breaks and link URLs.SRT to TextTurn SRT or VTT subtitles into a clean transcript with paragraphs, with or without timestamps.Transcript CleanerRemove timestamps, speaker labels and filler words like um and uh, and fix broken line breaks.Extract Dates from TextFind every date in text, in any common format, and convert them all to one format you choose.Extract Text Between DelimitersPull out every piece of text between brackets, quotes, HTML tags or your own start and end markers.Recipe Shopping List GeneratorPaste several recipes and get one combined grocery list with merged amounts, by store section.One Word Per LineSplit any text into a list with one word per line; strip punctuation, dedupe, lowercase and sort.Recipe FormatterPaste a messy recipe and get clean ingredients, numbered steps, scaling and a printable card.Remove Words from TextDelete a list of words or phrases from any text and see how many times each one was removed.Reverse Line OrderFlip the order of lines, list items or paragraphs so the last becomes first.Sort Lines by LengthSort lines from shortest to longest or the reverse, with ties sorted A-Z and lengths shown.Sort Words AlphabeticallyPut the words in any text in A-Z or Z-A order, remove duplicates and pick a separator.Sentence SplitterSplit text into one sentence per line, smart about abbreviations, decimals and quotes.Text to Table ConverterTurn tab, comma, pipe or space separated text into a table to copy as rich text, Markdown or plain text.Text TruncatorShorten text to a character, word or sentence limit without cutting words, with an ellipsis.Bulk Find and ReplaceApply a whole list of find → replace pairs to your text at once, with a per-pair change log.Contraction ConverterExpand contractions (don't → do not) for formal writing or contract phrases for a casual tone.Count Duplicate LinesCount how many times each line appears, sorted by frequency, with duplicates-only and CSV export.Double Space TextAdd blank lines between lines or paragraphs (1.5, double, triple spacing) or remove them again.Em Dash ReplacerReplace em and en dashes with commas, hyphens or periods and normalize ellipses and fancy punctuation.Extract Domains from URLsPull hostnames or root domains out of URL lists, strip www, dedupe and count links per domain.List to Sentence ConverterTurn a list into a natural sentence with commas and “and” or “or”, with an Oxford comma toggle.Merge Lines Side by SideCombine two to four lists line by line with any separator, padding or filling uneven lengths.Remove Line NumbersStrip leading numbers like 1., 1), [1] or code line numbers from every line and keep the text.Remove Stop WordsStrip common stop words (the, and, of…) from text in 7 languages to reveal the keywords.Remove Text in BracketsDelete everything inside ( ), [ ], { }, < > or custom markers, with nested bracket support.Remove URLs from TextStrip links, www addresses and bare domains from text, plus emails, @mentions or hashtags.Trim Characters from LinesRemove the first or last N characters, or text before/after a marker, on every line.Extract Numbers from TextPull every number out of text: decimals, negatives and percentages, with sum, average and CSV.Extract Phone NumbersFind phone numbers in any text, normalize them to E.164, remove duplicates and export CSV.Paragraph to Bullet Points ConverterSplit paragraphs into bullet points by sentence or clause, with your choice of bullet style.Compare Two ListsFind items only in list A, only in list B, in both lists, or in either, with copy and sort.DOCX to Text ConverterExtract plain text from Word .docx files, in batch, with list markers, tables and .txt download.
See all 96 Text Cleaning & Formatting →