Text Compare

Compare two texts side by side and highlight every added, removed and changed line.

  • Runs in your browser
  • Free, no sign-up

Paste text in both boxes to see the differences.

Paste two texts to compare

About the Text Compare

Paste an original text on the left and a changed version on the right, and Text Compare highlights every difference. Removed text is marked in red, added text in green, and inside a changed line the exact words that differ are highlighted too.

Use it to see what someone edited in a contract or an article, to check two versions of a configuration file, to find the one line that differs in a long list, or to proofread a translation update. You can compare by lines, by words or by single characters, and ignore differences in capitals or spacing when they do not matter.

The result can be shown side by side or in one column, folded down to just the changed parts, and exported as a standard .diff file. Both texts stay in your browser and are never uploaded.

How to use it

  1. Add both textsPaste the original on the left and the changed version on the right, or use Open or drag and drop to load files. Sample loads two versions of a short notice.
  2. Choose how to compareLines shows changed lines with the changed words highlighted. Words and Characters show the full text with every inserted or deleted word or character marked.
  3. Ignore what does not matterTurn on Ignore case to treat "Hello" and "hello" as equal, and Ignore spaces to skip differences in spacing.
  4. Pick a layoutIn Lines mode, choose Side by side or Inline, and turn on "Only changed lines" to hide long unchanged parts.
  5. Export the changesCopy diff or Download .diff gives you the changes in unified diff format, the format used by Git and code review tools.

Key features

Three levels of detail

Compare whole lines, single words or individual characters, depending on how small the changes are.

Changed words highlighted

When a line was edited, the words that changed are marked inside it, so you do not have to hunt for them.

Side by side or inline

See both versions next to each other with line numbers, or in one column with - and + markers.

Only changed lines

Long stretches of identical text fold into a single row, with three lines of context kept around each change.

Ignore case and spacing

Skip differences in capitals or in the number of spaces, tabs and line-end spaces.

Unified .diff export

Copy or download the changes as a patch that Git, code editors and review tools can read.

Examples

Comparing two versions of a notice

The Sample button loads an original and an edited version of an opening hours notice. The changed version has new weekday hours, an extra line for holidays and a reworded sentence.

Compare byStatus lineWhat is highlighted
Lines3 added · 2 removed, 5 lines unchangedTwo changed lines and one new line. Inside them, 9 and 5 become 8:30 and 6, and "an email" becomes "us a message".
Words7 words added · 4 removedThe same changes, shown in the flowing text instead of line by line.
Characters30 characters added · 6 removedOnly the letters that differ. In "an email" versus "us a message", the letters "n", "e" and "il" are marked as removed and "us ", "ess" and "ge" as added.

In Lines mode, a line that was edited counts once as removed and once as added, which is why the count says 3 added and 2 removed.

The exported diff

Download .diff for the sample produces a standard unified diff:

===================================================================
--- original.txt
+++ changed.txt
@@ -1,7 +1,8 @@
 Opening hours
-Monday to Friday: 9 AM to 5 PM
+Monday to Friday: 8:30 AM to 6 PM
 Saturday: 10 AM to 2 PM
 Sunday: closed
+Holidays: closed

-Call us at (555) 010-0199 or send an email.
+Call us at (555) 010-0199 or send us a message.
 We reply within two business days.
\ No newline at end of file

Lines starting with - were removed, lines starting with + were added, and lines starting with a space are unchanged context. The last line notes that the text does not end with a line break.

Ignoring case and spacing

Compare Hello World and second   line on the left with hello world and second line on the right:

SettingsResult
Neither option2 added · 2 removed
Ignore case1 added · 1 removed, because the spacing still differs
Ignore case and Ignore spacesNo differences

Finding one changed line in a long file

Compare two 30-line lists where only line 15 differs and turn on "Only changed lines". You see lines 12 to 18 and two folded rows: "11 unchanged lines" above and "12 unchanged lines" below.

Tips

  • Start with Lines for documents and code, then switch to Words or Characters when a line is marked as changed but you cannot see why. A changed comma or an extra space then becomes obvious.
  • If every line shows as changed, one of the texts probably has different spacing or capitalization. Turn on Ignore spaces or Ignore case and look again.
  • Swap exchanges the two texts. Use it when you pasted them the wrong way round, so additions and removals show in the right colors.
  • Save the .diff file when you need a record of what changed between two versions, for example when you send edits back to a colleague.
  • To compare JSON, use the JSON Diff Checker. It compares the data itself, so differences in indentation and line breaks do not show up as changes.

Common mistakes and limits

  • Comparing text with different line breaksIf one version is wrapped at 80 characters and the other is not, almost every line differs. Compare by Words, or remove the line breaks from both versions first.
  • Expecting moved text to be detectedA paragraph moved to another place shows as removed in one spot and added in another. The tool does not mark it as moved.
  • Reading Lines mode counts as editsAn edited line counts as one removed and one added line. Two edited lines therefore show as 2 added and 2 removed.
  • Forgetting the exported diff ignores the optionsCopy diff and Download .diff compare the texts exactly as typed. Ignore case and Ignore spaces only affect what is shown on screen.
  • Comparing formatted documentsBold, colors, comments and tracked changes from Word or Google Docs are lost when you paste plain text. Only the text itself is compared.

Frequently asked questions

How do I compare two texts for differences?
Paste the original in the left box and the new version in the right box. The differences appear below at once, with removed text in red and added text in green, and the status line counts them.
What is the difference between comparing by lines, words and characters?
Lines lists each changed line and highlights the changed words inside it, which suits code and documents. Words and Characters show the whole text as one block and mark each inserted or deleted word or character, which suits prose and small edits.
What does "Only changed lines" do?
It hides long unchanged parts and keeps three lines of context above and below each change. The hidden parts show as a row such as "11 unchanged lines".
What is a .diff file?
A plain text file in the unified diff format. It lists the removed lines with a minus sign, the added lines with a plus sign and a few unchanged lines for context. Git, patch tools and code editors can read it.
Can I compare files?
Yes. Use the Open button above each box, or drag a file onto it. Text files such as .txt, .csv, .json, .xml, .html, .css, .js, .py, .sql and .yml work. Word and PDF files need to be copied as text first.
Is there a size limit?
There is no fixed limit, and files up to 10 MB can be opened. When the two texts together are longer than 60,000 characters, the result refreshes a moment after you stop typing. If two very long texts are almost completely different, the tool may ask you to compare by lines instead.
Does it work with any language?
Yes. Text in any alphabet can be compared, and Ignore case works for accented, Greek and Cyrillic letters as well as plain English ones.
Are my texts uploaded anywhere?
No. The comparison runs entirely in your browser. Nothing is sent to a server, and the texts disappear when you close or reload the page.