ProteinIQ
Sign inStart for free
ProteinIQ

Sequence analysis

Pairwise sequence alignment

Compare two sequences directly, preserve the aligned strings and scoring settings, and separate correspondence from similarity scores.

Open workflow

Pairwise alignment workflows

Choose the workflow that matches your sequence type and comparison question. Each preserves its own aligned strings or score matrices without treating them as interchangeable.

Pairwise sequence alignment

Align a two-record FASTA with MAFFT and compare the same pair with a Needleman–Wunsch global score from StringZilla.

Open workflow

Pairwise protein alignment

Generate a two-protein MAFFT G-INS-i alignment alongside independent StringZilla Needleman–Wunsch global and Smith–Waterman local score matrices.

Open workflow

Pairwise DNA alignment

Generate a two-DNA-sequence MAFFT alignment alongside independent StringZilla Needleman–Wunsch global and Smith–Waterman local score matrices.

Open workflow

Pairwise alignment method comparison

Run MAFFT, Clustal Omega, and MUSCLE5 from the same two-protein input to inspect stable and method-sensitive correspondence separately.

Open workflow

Protein variant and construct comparison

Generate a MAFFT protein alignment and a separate StringZilla Levenshtein distance for a reference and its variant or construct.

Open workflow

What is pairwise sequence alignment?

Pairwise sequence alignment is the process of arranging exactly two biological sequences so that positions proposed to correspond appear in the same columns. Identical residues or nucleotides appear as matches, different characters appear as substitutions, and inserted gaps represent possible insertion or deletion events. The resulting alignment is a hypothesis about positional correspondence between the sequences, not a direct measurement of function or evolutionary history.

A pairwise alignment algorithm uses a scoring system to choose among many possible arrangements. Global alignment compares the sequences across their complete lengths, while local alignment finds the strongest matching region within them. Needleman–Wunsch is the classic global alignment algorithm, and Smith–Waterman is the classic local alignment algorithm. Both use dynamic programming to find an optimal result under the specified scoring model.

Use pairwise sequence alignment when you already have two sequences and want to:

  • compare a protein variant with its reference sequence;
  • align two homologous proteins or domains;
  • compare two alleles, amplicons, transcripts, or DNA constructs;
  • locate substitutions, insertions, and deletions;
  • map corresponding positions between two sequences;
  • measure identity across a defined alignment;
  • inspect whether two sequences share one strongly conserved region.

The alignment is only as meaningful as the question, inputs, and settings behind it. Two unrelated sequences can always be arranged somehow, and a numerically optimal alignment is not necessarily a biologically valid one.

Which pairwise alignment should you use?

Choose the alignment scope before choosing a particular sequence alignment tool.

Your questionRecommended approachBest suited forMain limitation
Should these two complete sequences correspond from beginning to end?Global sequence alignmentFull-length homologs, alleles, isoforms with similar architecture, and engineered constructsUnrelated terminal regions or extra domains can distort the result
What is the strongest shared region between these sequences?Local sequence alignmentConserved domains, motifs, fragments, and partial homologyIgnores weaker or unrelated regions outside the best local match
Does a fragment overlap one end of a longer sequence?Overlap or end-gap-aware alignmentAmplicons, reads, trimmed constructs, and partial sequencesEnd-gap treatment differs among tools and must be reported
Which database sequences resemble my query?BLAST or another similarity searchDiscovering possible homologs in a databaseA heuristic search is not the same calculation as an exact pairwise alignment
How do three or more homologous sequences correspond?Multiple sequence alignmentProtein families, conserved motifs, profiles, and phylogenetic preparationThe problem and algorithm differ from aligning only two sequences
Do weakly similar proteins share the same fold?Structure-based sequence alignmentProteins whose structural correspondence is clearer than their sequence similarityRequires compatible experimental or predicted structures

A global alignment is usually appropriate when both sequences represent comparable full-length molecules. A local alignment is safer when only one domain, motif, or subsequence is expected to correspond. Using global alignment merely because the input contains two sequences can force unrelated flanks into an apparently orderly but misleading result.

How to align two sequences online

A reliable online sequence alignment should begin with a scientific choice, not simply with pasting two strings into a form.

  1. Confirm the molecule type. Determine whether both inputs are proteins, DNA, or RNA. Do not align a nucleotide sequence directly against an amino-acid sequence.
  2. Prepare exactly two records. Preserve stable identifiers and remove accidental spaces, position numbers, unsupported symbols, or copied formatting.
  3. Choose global or local alignment. Compare complete lengths globally, or search for the best shared region locally.
  4. Select an appropriate scoring model. Protein alignments normally require an amino-acid substitution matrix. DNA alignments may use a nucleotide matrix or explicit match and mismatch scores.
  5. Record the gap settings. Gap-opening, gap-extension, and terminal-gap behavior can change both the alignment and its score.
  6. Inspect the aligned sequences. Review the actual matches, substitutions, gaps, coverage, and important biological positions rather than relying on one summary number.
  7. Save the method and settings. The same raw sequences can produce different results under another algorithm or parameter set.

A two-record FASTA input looks like this:

FASTA
>reference_protein
MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQ
>variant_protein
MKTAYIAKQRTISFVKSHFSRQLDERLGLIEVQ

FASTA headers should be unique. The sequence lines should contain only symbols supported for the selected molecule type. Ambiguous amino acids or nucleotides may be accepted by some tools, but the tool-specific treatment of those symbols should remain visible in the result.

Pairwise protein sequence alignment

Pairwise protein sequence alignment compares two amino-acid sequences. It is useful when you need to align two proteins, compare an engineered protein with its parent, inspect amino-acid substitutions, or map corresponding residues between known or suspected homologs.

Unlike a simple character match, a protein alignment can give different scores to different substitutions. Replacing leucine with isoleucine may be treated more favorably than replacing leucine with aspartate because the first pair has more similar physicochemical and evolutionary behavior. Protein alignment tools represent these preferences through substitution matrices such as BLOSUM or PAM. BLOSUM matrices were derived from conserved blocks in related protein families.

There is no universally correct matrix for every protein pair. Matrix choice, gap penalties, sequence length, domain architecture, and expected evolutionary distance all affect the result. Use the same settings when comparing scores between several protein pairs, and preserve the matrix name with every reported alignment.

Pairwise protein alignment is especially useful for:

  • Variant comparison. Locate substitutions, insertions, deletions, or altered termini between a reference and a mutant protein.
  • Ortholog or paralog comparison. Examine conserved positions and divergent regions between two related proteins.
  • Construct verification. Compare a designed sequence with the intended parent and confirm tags, linkers, deletions, or engineered mutations.
  • Domain comparison. Align two corresponding domains without allowing unrelated regions elsewhere in the proteins to control the result.
  • Residue mapping. Translate a position from one protein sequence to its aligned position in another.

If two proteins have different domain architectures, an end-to-end alignment may be the wrong model. Align the shared domain locally or compare the relevant subsequences directly. For broader guidance covering protein families and alignments of more than two records, see protein sequence alignment.

Pairwise DNA sequence alignment

Pairwise DNA sequence alignment arranges two nucleotide sequences to reveal exact base matches, substitutions, insertions, deletions, and unaligned ends. A DNA alignment tool is appropriate for comparing two alleles, amplicons, plasmid constructs, coding sequences, transcripts, or homologous genomic regions.

Before aligning two DNA sequences, check their orientation. A sequence and the reverse complement of its homolog can appear unrelated if both are submitted in their original direction. Some alignment software can test orientation automatically, while other tools require you to reverse-complement one sequence first. MAFFT provides direction-adjustment modes for nucleotide alignments, but orientation handling depends on the selected implementation and settings.

Important DNA-specific decisions include:

  • Orientation. Confirm that both records represent the same strand direction.
  • Ambiguous bases. Record how symbols such as N, R, or Y are interpreted.
  • Coding versus genomic sequence. Genomic DNA and mature messenger RNA may differ by entire introns and normally require a spliced-alignment method rather than a generic pairwise aligner.
  • Complete versus partial sequence. Use global alignment for comparable full-length constructs and local or overlap alignment for fragments.
  • Whole-genome scale. Long assemblies, rearrangements, and synteny require a dedicated whole-genome alignment workflow.
  • Protein-coding interpretation. A nucleotide alignment identifies base-level changes, while translating and aligning the proteins answers a different question about amino-acid conservation.

For a workflow configured specifically for nucleotide input, use DNA sequence alignment.

How is a sequence alignment score calculated?

A sequence alignment score is the total value assigned to one proposed alignment under a defined scoring system. It normally combines scores for aligned character pairs with penalties or negative scores for gaps.

Conceptually:

Text
alignment score =
  sum of match or substitution scores
  + sum of gap-opening scores
  + sum of gap-extension scores

With a common affine gap model, the score or penalty for a gap of length k depends on one gap-opening term plus k - 1 gap-extension terms:

Text
gap score(k) = gap open + (k - 1) × gap extension

The exact sign convention differs among tools: one program may display positive penalties that are subtracted, while another may expose negative gap scores that are added. EMBOSS Needle, for example, reports the comparison matrix, gap-opening penalty, gap-extension penalty, aligned length, identity, similarity, gaps, and final score together.

Score componentWhat it representsEffect of changing it
Match scoreReward for aligning identical residues or basesA larger reward favors alignments containing more exact matches
Substitution or mismatch scoreValue assigned to non-identical aligned charactersProtein matrices distinguish conservative from unfavorable substitutions
Gap-open scoreCost of starting an insertion or deletionA stronger penalty tends to produce fewer separate gaps
Gap-extension scoreAdditional cost for lengthening an existing gapA weaker extension penalty favors fewer, longer gaps over many short gaps
Terminal-gap treatmentWhether unaligned sequence ends are penalizedCan strongly affect fragments, tags, incomplete sequences, and unequal lengths

A raw sequence alignment score has meaning only in its original context. Do not directly compare scores produced with:

  • different algorithms;
  • different substitution matrices;
  • different gap settings;
  • global versus local alignment;
  • different sequence lengths;
  • protein versus nucleotide scoring;
  • different treatments of terminal gaps or ambiguous symbols.

A longer pair of similar sequences will often produce a larger raw score than a shorter pair, even when the shorter pair has a higher percentage identity. BLAST bit scores and E-values apply statistical normalization to local search results, but not every pairwise alignment program reports those statistics.

How to interpret identity, similarity, coverage, and gaps

A pairwise alignment should be interpreted as a collection of related measurements rather than one definitive percentage.

MetricMeaningCommon interpretation error
Aligned lengthNumber of columns in the reported alignmentAssuming it equals both original sequence lengths
Exact matchesColumns containing the same residue or nucleotideIgnoring whether the match covers a meaningful part of each sequence
Percent identityExact matches divided by a stated denominatorReporting the percentage without saying which denominator was used
Protein similarityExact or matrix-favored amino-acid pairsTreating it as a molecule-independent quantity
Query coverageFraction of the first sequence included in the aligned regionConfusing high local identity with full-length correspondence
Target coverageFraction of the second sequence included in the aligned regionReporting only query coverage when the second sequence is much longer
GapsAlignment columns containing an insertion or deletion characterAssuming every gap corresponds to one known historical mutation event
Raw scoreObjective optimized by the selected methodComparing scores from different settings or programs

Percent identity

Percent identity is usually calculated as:

Text
percent identity = exact matches / stated denominator × 100

The denominator may be the complete alignment length, the number of non-gap aligned columns, the query length, the target length, or another explicitly defined value. EMBOSS Needle reports identity over the aligned region using its reported alignment length, including gap-containing columns in that length.

For reproducibility, report the numerator and denominator as well as the percentage—for example, 31/33 identical aligned positions (93.9%).

Protein similarity

Protein similarity includes amino-acid pairs that receive a favorable value in the selected substitution matrix. It is therefore matrix-dependent. Two protein sequences can have the same percent identity but different similarity scores because their non-identical residues differ in how conservatively they substitute.

For DNA, “similarity” is sometimes used loosely as a synonym for identity. State the exact score or matrix definition instead of assuming that the term has one universal meaning.

Coverage

Identity without coverage can be misleading. Two 500-residue proteins may share a 40-residue domain with 90% local identity while the remaining 460 residues do not align. That result answers a different question from 90% identity across both complete proteins.

Report coverage separately for each sequence when their lengths differ.

Homology

Homology means descent from a common ancestor. It is not a percentage. Sequences may be homologous or not homologous; they are not “80% homologous.” Sequence identity, similarity, alignment length, statistical significance, structural correspondence, and biological context provide evidence used to infer homology.

Worked example: compare two protein sequences

Consider these two aligned amino-acid sequences:

Text
reference  MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQ
variant    MKTAYIAKQRTISFVKSHFSRQLDERLGLIEVQ
           ||||||||||.||||||||||||.|||||||||

The sequences have:

  • 33 aligned positions;
  • 31 exact matches;
  • two substitutions;
  • no gaps;
  • 93.9% identity when calculated as 31 / 33 × 100.

The first substitution is Q → T, while the second is E → D. A protein substitution matrix may score E → D more favorably because both residues are acidic, so matrix-based similarity may be higher than exact identity.

The alignment score still cannot be determined from the displayed strings alone. It also requires the substitution matrix or match/mismatch values and the selected gap model.

Even a 93.9% identity result does not establish that the proteins have identical activity. A substitution at an active site, binding interface, cleavage site, localization signal, or structurally constrained position may matter more than many conserved residues elsewhere. Always inspect biologically important positions directly.

Pairwise alignment versus BLAST and multiple sequence alignment

Several tools can display two sequences in aligned rows, but they do not necessarily perform the same calculation.

MethodTypical resultBest useImportant distinction
Needleman–WunschOptimal global alignment and score under one scoring modelTwo complete sequences expected to correspond end to endEvaluates the full lengths of both sequences
Smith–WatermanOptimal local alignment and score under one scoring modelBest shared domain, motif, or subsequenceCan leave unrelated flanks outside the alignment
BLAST with query and subject sequencesOne or more heuristic local alignments with statistical measuresFast local comparison and significance assessmentBLAST is heuristic and is not guaranteed to return the exact dynamic-programming optimum
MAFFT with two recordsTwo aligned sequences produced by the selected MAFFT strategyConvenient protein or nucleotide alignment with configurable modesMAFFT is a multiple-sequence alignment program; preserve the actual strategy and settings
Clustal Omega with two recordsA two-row alignment produced by a progressive MSA systemCompatibility with Clustal workflows and downstream formatsIt should not automatically be described as an exact Needleman–Wunsch calculation
Multiple sequence alignmentAlignment of three or more homologous sequencesFamilies, conserved columns, profiles, and phylogeneticsAdditional sequences change the optimization problem and may alter column placement

Can Clustal Omega align two sequences?

Yes. Clustal Omega can accept two sequences and return an aligned output, so “Clustal pairwise alignment” is a reasonable description of the resulting two-row file. However, Clustal Omega is designed as a multiple sequence alignment program. Its progressive and profile-based methods should not be confused with a dedicated exact pairwise dynamic-programming implementation.

Use Clustal Omega when you need its formats or expect to expand the analysis to more sequences. Use a dedicated global or local pairwise method when the exact score and algorithmic definition are central to the question.

Is pairwise alignment the same as a sequence search?

No. Pairwise alignment directly compares two supplied sequences. A sequence-search tool compares a query with many database records and ranks possible matches. NCBI’s BLAST two-sequence mode allows a query and subject to be compared directly, but it still uses BLAST’s heuristic local-search behavior.

Common mistakes when comparing two sequences

Choosing global alignment for sequences that share only one region

A global method must account for both complete lengths. If one sequence contains an extra domain, long tag, signal peptide, or unrelated flank, the alignment may contain many gaps and weakly supported correspondences. Use local alignment or isolate the shared domain.

Using local identity as though it described both complete sequences

A short local alignment can have very high identity while covering only a small fraction of each input. Always report aligned length and coverage.

Comparing DNA sequences in opposite orientations

A reverse-complemented homolog can appear unrelated to the original strand. Confirm DNA orientation before interpreting a poor alignment.

Comparing the wrong sequence boundaries

Isoforms, precursor proteins, mature chains, transit peptides, tags, and incomplete records can produce terminal differences that are artifacts of sequence selection rather than biological divergence.

Treating every alignment score as comparable

A raw score from one matrix or gap model cannot be ranked directly against a score produced with another configuration. Preserve the complete scoring definition.

Reporting “percent homology”

Report percent identity or a clearly defined similarity metric. Homology is an evolutionary inference, not a continuous percentage.

Ignoring low-complexity or repetitive regions

Repeats may support several alignments with similar scores. The top-scoring path can look precise even when the positional correspondence is ambiguous.

Using generic pairwise alignment for a specialized problem

Genomic DNA versus messenger RNA requires spliced alignment. Complete genomes require genome-scale methods. Very weak protein similarity may require profile or structure-based comparison. Choose the method that represents the biological problem rather than forcing every comparison into the same two-sequence tool.

What should an online sequence alignment tool return?

Useful online sequence alignment software should make the result inspectable and reproducible. At minimum, retain:

  • the original sequence identifiers and unaligned inputs;
  • the aligned sequences with inserted gaps;
  • the algorithm and software version;
  • global, local, overlap, or other alignment scope;
  • the protein matrix or nucleotide scoring model;
  • gap-opening, gap-extension, and terminal-gap settings;
  • the raw alignment score and its definition;
  • identity as both a count and percentage;
  • the identity denominator;
  • aligned length and coverage for both sequences;
  • the number and distribution of gaps;
  • warnings, rejected symbols, or failed records;
  • downloadable alignment and result files.

Do not accept an unlabeled “sequence match” percentage as a complete result. Without the alignment scope, denominator, score definition, and input coverage, the number may answer a different question from the one you intended to ask.

The featured ProteinIQ workflow below keeps two forms of evidence separate: MAFFT returns the aligned sequence strings, while StringZilla v5 independently calculates a Needleman–Wunsch global score. The score and alignment are related, but they are not interchangeable outputs.

How pairwise sequence alignment works

MAFFT returns aligned sequences while StringZilla independently returns a Needleman–Wunsch global score; the workflow keeps those outputs distinct.

  1. Define scope. Decide whether the full sequences or only a shared region should be compared.
  2. Prepare the pair. Verify molecule type, orientation, headers, boundaries, and ambiguous symbols.
  3. Set scoring. Record the substitution and gap settings rather than relying on an unlabeled score.
  4. Run comparison. Generate aligned strings and, when useful, an independent pairwise score.
  5. Interpret and export. Inspect identity, coverage, gaps, terminal effects, and biologically important positions.

Inputs and outputs

Check formats before running, then inspect and download the result from every workflow step.

Inputs

Alignment input

FASTAPDBmmCIF

Two protein, DNA, or RNA sequences in FASTA format.

Outputs

Alignment outputs

FASTACSVTSVPDBJSON

Aligned FASTA plus method-native score tables and downloadable settings.

On this page

  • What is pairwise sequence alignment?
  • Which pairwise alignment should you use?
  • How to align two sequences online
  • Pairwise protein sequence alignment
  • Pairwise DNA sequence alignment
  • How is a sequence alignment score calculated?
  • How to interpret identity, similarity, coverage, and gaps
  • Worked example: compare two protein sequences
  • Pairwise alignment versus BLAST and multiple sequence alignment
  • Common mistakes when comparing two sequences
  • What should an online sequence alignment tool return?
  • How it works
  • Inputs & outputs

Tools for pairwise sequence alignment

Use these methods to prepare inputs, run the core analysis, inspect outputs, and validate the evidence described in this workflow.

MAFFT

MAFFT

Create configurable protein, DNA, or RNA alignments

sequence-analysisalignment+5
StringZilla v5

StringZilla v5

Calculate pairwise global, local, or edit-distance score matrices

sequence-analysisalignment+4
Clustal Omega

Clustal Omega

Create scalable protein or nucleotide multiple-sequence alignments

sequence-analysisalignment+3
MUSCLE5

MUSCLE5

Generate conventional or ensemble multiple-sequence alignments

sequence-analysisalignment+5
HMMER

HMMER

Find homologs with profile hidden Markov models

sequence-analysiscomparison+2
MMseqs2

MMseqs2

Search and cluster large protein or nucleotide sequence sets

sequence-analysiscomparison+4
USAlign

USAlign

Align macromolecular structures and derive residue correspondence

structure-analysisalignment+4
FoldSeek

FoldSeek

Find and compare structurally similar proteins

structure-analysisalignment+3
PDB to FASTA converter

PDB to FASTA converter

Extract sequences from structures before comparison

format-conversionprotein+2
FastTree

FastTree

Estimate trees from large sequence alignments

sequence-analysisalignment+3
IQ-TREE

IQ-TREE

Infer maximum-likelihood phylogenies from alignments

sequence-analysisalignment+3
RAxML-NG

RAxML-NG

Run maximum-likelihood phylogenetic analysis

sequence-analysiscomparison+4

Other sequence analysis workflows

Compare related approaches based on the molecular system, available evidence, required inputs, and decision you need to support.

Multiple sequence alignment

Aligns three or more homologous sequences to identify shared positions, insertions, deletions, and conserved regions.

Global sequence alignment

Compares sequences end to end, including terminal differences and gaps across their full lengths.

Protein sequence alignment

Aligns amino-acid sequences using substitution-aware methods suited to protein evolution and function.

DNA sequence alignment

Aligns nucleotide sequences to compare homologous genes, amplicons, loci, transcripts, or constructs.

Local sequence alignment

Finds or scores the best-matching subsequences without forcing unrelated flanks into the comparison.

Whole genome alignment

Maps large homologous regions between genome assemblies and reports coordinates, rearrangements, and sequence differences.

Structure-based sequence alignment

Uses three-dimensional correspondence to align residues whose sequence similarity alone may be weak.

Frequently asked questions

Two protein, DNA, or RNA sequences in FASTA format.

Aligned FASTA plus method-native score tables and downloadable settings.

Start from the scientific scope: global or local, pairwise or multiple, sequence or structure, and conventional or genome scale. Then record the method, substitution model, gap settings, sequence type, and any filtering rather than relying on defaults without provenance.

No. Scores and identities quantify similarity under a defined model. Homology is an evolutionary interpretation, and shared function requires additional evidence such as domain context, conserved residues, structure, phylogeny, experiments, or curated annotation.

Preserve both raw sequences, algorithm, substitution and gap settings, aligned strings, and score definition.

A complete pairwise sequence alignment project is usually quote-based because providers scope sequence curation, method selection, alignment review, interpretation, and downstream analysis together. Harvard’s FY26 bioinformatics core first defines deliverables and a time estimate, then charges $180–$265 per hour; MSU lists $84–$110 per hour and expects at least eight consultant hours for custom analysis.

The total depends on sequence count and length, input cleanup, molecular type, the number of methods compared, manual review, genome scale, figures, phylogenetic or structural follow-up, and whether the deliverable includes interpretation or only alignment files.

ProteinIQ self-service starts at $29 per month for academic Plus and $99 per month for commercial Pro, with the configured pairwise sequence alignment run estimated in credits before submission. Done-for-you analysis is scoped separately and can include data preparation, method comparison, interpretation, and a reproducible handoff.

Start with a workflow you can inspect and edit

Add your inputs, review the settings, and keep every structure, score, table, and file connected to the step that produced it.

Open workflow
ProteinIQ

© 2026 ProteinIQ

Products

  • Bioinformatics tools
  • Workflows
  • PDB viewer
  • API

Solutions

  • Small molecule
  • RNA discovery
  • Antibody engineering
  • Peptide discovery
  • Enzyme engineering
  • Protein engineering
  • Virtual screening
  • Molecular docking
  • Protein structure prediction
  • RNA structure prediction
  • Protein structure alignment
  • Protein design
  • Sequence alignment
  • Phylogenetic analysis
  • Molecular dynamics simulation

Resources

  • Documentation
  • Blog
  • Guides
  • Datasets
  • Changelog
  • Sitemap

Company

  • About
  • Contact
  • Enterprise
  • Pricing
  • Security
  • Trust center
  • Author
  • Legal
  • Terms
  • Privacy policy

Connect

  • LinkedIn
  • X
  • Discord
  • Pricing