Home / Science / Molecular and cell biology / Genomics and bioinformatics / Pairwise sequence alignmentTool #172

Pairwise sequence alignment: Needleman-Wunsch and Smith-Waterman for DNA or protein, with a dot plot

Align two DNA or protein sequences end to end (global), with free end gaps (semi-global) or by their best-matching stretch (local), with affine gap scores you can set. See the score, identity, similarity and gaps, the alignment in blocks, and a dot plot. Runs in your browser.

Keep it one tap away for everyday use.

Bookmark Pairwise sequence alignment?

Press Ctrl + D now. Your browser opens its own bookmark box, where you choose the name and folder.

  1. Sequences
  2. Scores
  3. Alignment
  4. Dot plot
Nothing is uploadedWorks offline once open

Sequences

The first record of each box or file is used; numbers and spaces are ignored. Up to 25 million cells (for example 5,000 × 5,000 letters). Files stay on your device. The examples are made-up random sequences.

Settings

Global lines up both sequences from end to end. Semi-global does too, but gaps before or after a sequence cost nothing, for a short piece inside a longer one. Local finds the best-matching stretch. A gap of length k costs the opening score plus (k − 1) times the extension score. Protein groups: ILMV, FWY, KRH, DE, STNQ, AG, C and P (simple side-chain classes, not a published matrix).

Alignment

 

Dot plot

Download

What it does

An alignment lines up two sequences so that matching letters sit in the same column, with gaps (-) where one sequence has letters the other lacks. It is the first step in comparing a clone with its reference, two versions of a gene, or a protein with a relative. This page aligns two sequences in your browser:

  • Three kinds of alignment. Global (Needleman-Wunsch) lines up both sequences from end to end. Semi-global does the same but doesn’t charge for gaps before or after either sequence, which suits a read or primer inside a longer sequence. Local (Smith-Waterman) finds the best-matching stretch and ignores the rest.
  • Affine gaps. Opening a gap costs more than making it longer, so one gap of 6 is preferred to six gaps of 1, as in real insertions and deletions.
  • DNA or protein. DNA scores a match and a mismatch. Protein scores the same amino acid, the same side-chain group, or a different group.
  • Results. Score, identical and similar columns, gaps, the aligned part of each sequence, the alignment in blocks that fit your screen, and a dot plot.

How to use it

  1. Sequences. Paste two sequences or open two FASTA files. The first record of each is used.
  2. Scores. Choose the kind and the alignment, and change the scores if you like. Gap scores are penalties, so they are negative.
  3. Alignment. Read the summary and the blocks: | marks identical letters, : marks letters in the same group (protein).
  4. Dot plot. Each dot means the same few letters in a row appear in both sequences. A clean diagonal is a good match, a sideways step is a gap, and orange dots on DNA are matches on the opposite strand.

Download the alignment as FASTA or text, or the report as an image, PDF or Word file.

Worked example

The example is a made-up 240-base gene and a copy with 6 changed bases, 6 extra bases after position 80 and 4 missing bases after 170, 242 bases in all. With the default DNA scores (match +2, mismatch −3, gap opening −5, extension −2), the global alignment has 246 columns: 230 identical, 6 mismatched and 10 gap columns in 2 gaps. The score is 230 × 2 − 6 × 3 − (5 + 5 × 2) − (5 + 3 × 2) = 416, and identity is 93.5 %. The dot plot shows one diagonal with a small step at each gap.

FAQ

Why did I get a different alignment from another program with the same score? There are often several alignments with the same best score. This page keeps matches over gaps when there is a tie, and another program may choose differently.

How long can the sequences be? Up to 25 million cells, for example two 5,000-letter sequences. For a long genome, cut out the region you need, or use local mode on a shorter piece.

Can I use BLOSUM62? Not built in, because published matrices are not copied here. The group scores give sensible protein alignments; use a dedicated tool when you need a specific matrix.

Where the numbers come from

  • Global (Needleman-Wunsch), local (Smith-Waterman) and semi-global alignment with affine gaps (Gotoh's method) written by fibub. Optimal scores checked in the tests against Biopython 1.88 PairwiseAligner with the same scores.
  • Protein scoring uses eight simple side-chain groups (ILMV, FWY, KRH, DE, STNQ, AG, C, P) written by fibub. It is not BLOSUM, PAM or any other published substitution matrix.
  • The example DNA and protein pairs are made-up random sequences with planted changes.

Standard scientific values, such as constants, atomic weights and melting points, are facts found in every textbook; we name where ours were checked. If you are an author or publisher and want a value, a credit or a table changed or removed, tell us and we will act quickly.

Last updated 2026-11-09.

Change log for Pairwise sequence alignment

  1. Add #172 pairwise sequence alignment (global, local, semi-global, affine gaps, dot plot) Details on GitHub

Every change to fibub

Related tools

FASTQ and FASTA quality inspector #171 Open a FASTQ or FASTA file of any size (.gz too) and see read counts, lengths and N50, GC content per read, quality by position as boxes, reads by mean quality, base composition along the read and the most repeated sequences. The file is read on your device and never uploaded. Phylogenetic tree viewer #177 Open a Newick or NEXUS tree file and draw it as a rectangular or circular tree, with branch lengths and support values. Reroot it at the midpoint or on any branch, ladderize, swap branches and colour groups. Download SVG, Newick, tip distances (CSV) or a report. Nothing is uploaded. Punnett square and pedigree probability #202 Draw a Punnett square for 1 to 4 genes (complete, incomplete and codominant dominance, ABO blood groups, X-linked traits) and get the genotype and phenotype ratios as exact fractions. Use the branch method for up to 6 genes, the binomial rule for several children, and a Bayes table for carrier risk in a family. For learning, not genetic counselling. Ramachandran plot #186 Open a protein structure (PDB or mmCIF) and get every residue's backbone phi, psi and omega angles, plotted on a Ramachandran plot with glycine and proline marked, broad guide regions for helix and sheet, a list of residues outside them and of cis peptides, and CSV, image, PDF or Word downloads. The file is never uploaded. VCF viewer and filter #173 Open a VCF or .vcf.gz file of any size and see variant types, Ti/Tv ratio, multi-allelic sites, FILTER and QUAL, allele frequencies, genotypes per sample and counts by chromosome. Filter by chromosome, region, QUAL, depth, PASS and type, then download the filtered VCF. Nothing is uploaded. k-mer counter and spectrum #176 Count every k-letter word in FASTA or FASTQ files (gzip too, any size), with reverse complements together. See the k-mer spectrum, the most common k-mers, a look-up box and a rough genome size from the spectrum's peak. Download the spectrum as CSV. Nothing is uploaded. DNA sequence tools #163 Paste a DNA or RNA sequence or open a FASTA file. Get the length and GC content, the reverse complement, the protein in any of the six reading frames, every open reading frame above a length you choose drawn on a map, and a codon usage table. Runs in your browser; your sequence never leaves the device. Primer checker #167 Check a PCR primer pair before you order it. Get the length, GC %, melting temperature by three simple formulas, the G/C clamp, runs and repeats, the longest hairpin, self- and cross-dimers with a picture of the worst one, and, with a template, every binding site and the product size. Restriction digest simulator #168 Paste a plasmid or other DNA, pick classic enzymes or type your own sites, and see every cut on both strands, the fragment sizes for single and combined digests, a circular or linear map, single cutters for cloning, and a virtual gel next to your ladder. Plasmid map viewer and editor #170 Open or paste a GenBank or FASTA file and get a clean circular or linear plasmid map with feature arrows, single-cutter sites and a size ruler. Rename, recolour, move or add features, move the origin, and download the map as SVG, PNG or PDF and the plasmid as GenBank. Carrier risk calculator (Bayesian) #500 Work out the chance that a relative is a carrier of an autosomal recessive or X-linked recessive condition, from her place in the family, her unaffected sons and a negative carrier test with its detection rate. Exact fractions, the prior, conditional, joint and posterior table step by step, and the risk for her children. Tree builder #308 Paste aligned DNA sequences (FASTA) and build a tree by neighbour joining or UPGMA on p, Jukes-Cantor or Kimura 2-parameter distances, or by maximum parsimony with an exact branch and bound search. See the distances, root the tree and download it as Newick. Runs in your browser. Molecular clock calculator #309 Estimate when two species or genes split from their genetic distance and a substitution rate (T = d / 2r), or work out the rate from a known split. Distances from two aligned sequences or site counts with Jukes-Cantor or Kimura 2-parameter correction, error ranges, and Tajima's relative rate test with an outgroup. Runs in your browser. dN/dS calculator #311 Paste two aligned protein-coding DNA sequences and get dN, dS and dN/dS (Ka/Ks) by the Nei-Gojobori method with the Jukes-Cantor correction: synonymous and nonsynonymous sites and differences, standard errors, a Z test for selection and a codon-by-codon table. Runs in your browser. Coalescent simulator #314 Simulate the family tree of a sample of gene copies back to their most recent common ancestor under the Kingman coalescent. See the tree with its mutations, then compare thousands of genealogies with the expected time to the common ancestor, total branch length, number of segregating sites and Watterson's estimate of θ. Seeded random numbers, so every tree can be repeated. Stylometry: Burrows' Delta #413 Paste or open several texts, compare them on their most frequent words with Burrows' Delta, see a clustered heat map of the distances, and find the closest candidate author for a disputed text. Nothing is uploaded.