TextJanitor

Text Compare

Paste an original and a changed version to see exactly what was added, removed or left alone, by line, word or character.

Compare by

Working…

Added
+0
Removed
−0
Unchanged
0
Similarity
100%

Differences

Added text is green and underlined, marked +. Removed text is red and struck through, marked −.

The two texts are identical with the current options.

Your text is processed in your browser and is never uploaded or stored on our servers.

How to use the Text Compare

  1. 1 Paste the original text on the left and the changed text on the right.
  2. 2 Choose whether to compare by line, word or character, and set the options for case, spaces and blank lines.
  3. 3 Read the differences inline or side by side. Added text is green and underlined, removed text is red and struck through.
  4. 4 Copy the result as a unified diff or download it.

What a text compare tool does

A text compare tool, also called a diff tool, lines up two versions of a text and marks what changed between them. It finds the longest stretch the two versions share, treats everything else as an addition or a removal, and shows the result so you do not have to read both versions side by side by eye. It is useful for checking an edited draft, a contract revision, a translation update, a configuration file or two pieces of code.

Before

It was a sunny day. The dog slept.

After

It was a sunny day. The sleepy dog slept. The birds sang.

Line, word or character

  • Line mode compares whole lines. It is the right choice for code, lists and files, and it is the fastest.
  • Word mode finds changes inside a sentence, so one swapped word does not mark the whole line as changed.
  • Character mode shows the smallest changes, such as a typo fix. It is limited to shorter texts, and the tool tells you when to switch to word or line mode.

Options

Ignore case treats capital and small letters as the same. Ignore whitespace differences collapses runs of spaces and tabs before comparing lines, so a reformatted paragraph does not light up. Ignore blank lines removes empty lines from both texts first. Together they let you focus on changes in meaning rather than formatting.

Reading the results

The summary shows how many lines, words or characters were added, removed and left unchanged, plus a similarity percentage. The percentage is twice the unchanged part divided by the total size of both texts, so two identical texts score 100 and two completely different texts score 0. Added and removed text is marked with a plus or minus sign, an underline or a strikethrough, and not by color alone.

Copying and sharing the diff

The unified diff is the plain text format used by version control tools: a header, then sections that start with @@ and list the lines that changed, with three unchanged lines around each change. You can paste it into an email, a ticket or a code review. To clean up pasted text before comparing, try the line break remover, or the duplicate line remover when comparing lists.

When two texts are completely different, the tool simplifies the comparison and says so, because finding the smallest set of changes would take a very long time. Switching to line or word mode usually gives a clearer picture.

Frequently asked questions

How does the text comparison work?

It finds the longest sequence of lines, words or characters the two texts share, and marks everything outside it as added or removed. This is the same idea used by version control tools.

What is the difference between line, word and character mode?

Line mode compares whole lines, word mode compares individual words, and character mode compares single characters. Smaller units show finer changes but need more work, so character mode is limited to shorter texts.

What is a unified diff?

A standard text format that lists changes line by line, with minus signs for removed lines, plus signs for added lines and a few lines of context around each change. Developers use it in patches and code reviews.

Why does it say the comparison is simplified?

When two large texts are almost completely different, finding the smallest list of changes is very slow. The tool then shows the first text as removed and the second as added. Try line or word mode for a closer look.

How is the similarity percentage calculated?

It is twice the number of unchanged units divided by the total number of units in both texts. Identical texts score 100 percent and texts with nothing in common score 0.

Are my texts uploaded?

No. The comparison runs in your browser and neither text leaves your device.