DNA compare

Lists every position where two DNA sequences differ, with or without aligning them first.

Differences

What this tool tells you

It answers one question: where do these two DNA sequences differ, and how? The result is a list of differences, each with its position in sequence 1, the base in each sequence and a short name for the change. Sequence 1 is treated as the reference, so a deletion means a base that sequence 1 has and sequence 2 does not.

For the summary side of the same comparison, percent identity and similarity across a whole alignment and over every pair in a multiple alignment, use theidentity and similarity calculator. This page lists the positions; that one counts the columns.

Align first, or compare position by position?

  • Align first runs a global Needleman–Wunsch alignment before comparing, so insertions and deletions are found and the bases after them stay in register. Use it for a clone against its reference, two alleles, or any pair that may differ in length.
  • No alignment compares column by column, with no alignment step. Use it when the two sequences are the same length and in register, or when they are already aligned and still carry their gap characters, which are kept and reported as indels.

The alignment uses match +1, mismatch −1, gap open 5 and gap extend 1, the defaults of theNeedleman–Wunsch tool, where the scores can be changed and the matrix inspected.

How is percent identity calculated?

identity % = identical columns ÷ alignment length × 100

The denominator is every column of the comparison, gap columns included, which is the BLAST convention and the one used across this site. A three-base deletion therefore costs three columns of identity. The number of identical, mismatched and gap columns is given so you can recompute under another convention.

How the changes are named

NameMeaning
28G>APosition 28 is G in sequence 1 and A in sequence 2
58_60delPositions 58 to 60 are missing from sequence 2
44delTThe single base T at position 44 is missing
42_43insTTSequence 2 has TT between positions 42 and 43

These follow the style of HGVS variant names but carry no reference sequence identifier, so they describe the pasted pair only. For a report, name the reference yourself.

Worked example

The example loads a 66 base reference and a 63 base clone. On the "Align first" tab the alignment is 66 columns long and holds 3 differences: 12T>C,28G>A and 58_60del, a three-base deletion. That leaves 61 identical columns, 2 mismatches and 3 gap columns, so identity is 61 ÷ 66 × 100 = 92.4 %. Switch to "No alignment" and the same pair gives dozens of apparent mismatches after position 57, because the deletion shifts the rest of the clone out of register.

Ambiguity codes and case

Input is read as IUPAC nucleotide codes, uppercased, with whitespace and position numbers ignored, so text pasted from GenBank works. U is read as T, so an RNA sequence can be compared with its DNA. Ambiguity codes are compared as literal characters: R against A is a difference, not a partial match, because a comparison should report what the two files actually say. To expand ambiguity codes first, use the IUPAC expander.

Frequently asked questions

How do I compare two DNA sequences and see what differs?

Paste one sequence in each box. On the "Align first" tab the two are aligned end to end, so insertions and deletions are found as well as substitutions; on the "No alignment" tab they are compared position by position, which is what you want for two sequences that are already the same length or already aligned. Every difference is listed with its position in sequence 1.

What do the change descriptions mean?

They follow the style of HGVS variant names, counted on sequence 1. 28G>A means position 28 holds G in sequence 1 and A in sequence 2. 58_60del means positions 58 to 60 of sequence 1 are missing from sequence 2. 42_43insTT means TT sits between positions 42 and 43 of sequence 1. The names have no reference transcript in front of them, so they describe the pair you pasted and nothing else.

Which positions do the numbers refer to?

Positions in sequence 1, counted from 1 and ignoring any gaps. Sequence 1 is the reference: differences are described as changes from sequence 1 to sequence 2. Swap the two boxes to reverse the direction, which turns every deletion into an insertion.

Why do the two sequences have to be aligned to find indels?

A position by position comparison has no way to slide one sequence along the other. A single missing base shifts everything after it, so a comparison without alignment reports a wall of mismatches from that point on instead of one deletion. The "Align first" tab runs a global Needleman–Wunsch alignment before comparing, which places the gap and leaves the rest matching.

Is there a length limit?

Aligning needs memory proportional to the product of the two lengths, so a pair of a few thousand bases each is comfortable and much more than that gets slow. The "No alignment" tab is linear and handles very long sequences. Nothing is uploaded either way.