How to compare two texts

  1. Paste both versions

    Original text on the left, changed version on the right. Copy from a document, a PDF, an email, or a code editor; only the text matters.

  2. Click Compare Text

    Both versions are lined up and every difference is highlighted in a second or two.

  3. Read the result

    Removed lines are red, added lines are green, and modified lines show exactly which characters changed. Totals appear above the comparison.

  4. Share it if you like

    Click Share above the result to get a link you can send to a colleague or client. The link expires after a month unless you pick a different period.

What CompareText shows you

CompareText is a free online diff tool for anyone who needs to see what changed between two versions of a text: writers and editors checking a revised draft, developers comparing code or configuration files, students and researchers checking quotations, and anyone comparing two versions of a contract, policy, or email.

Clean up text and tune the comparison

Once you have a result, the text tools and comparison options appear in the bar above the differences. Small formatting differences can bury the changes you care about: the tools clean up both sides before they are compared, without changing what you pasted, and the options control how differences are found. Change any of them and the comparison is redone.

Text tools

  • Sort linescompares both texts with their lines in order, so reordered lists compare cleanly
  • To lowercaseignores differences in capitalization
  • Replace line breaks with spacescompares each text as a single line, so hard-wrapped paragraphs line up
  • Trim whitespaceignores leading and trailing spaces and empty lines
  • swaps the two sides

Comparison options

  • Ignore edge whitespaceskips changes that only affect indentation or trailing spaces
  • Subword highlightingmarks changes inside identifiers such as getUserName versus getUserNames
  • Show unchanged linesdisplays the full text instead of collapsing identical sections
  • Viewswitches between side by side and unified

Your text stays private

Your text is sent over an encrypted connection, compared, and returned; nothing is saved. A comparison is only stored when you click Share, and it is deleted when its link expires. See the privacy page for details.

Frequently asked questions

How do I compare two texts and find the differences?

Paste the first version into the left box and the second version into the right box, then click Compare Text. CompareText lines up both versions, marks removed lines in red and added lines in green, and highlights the exact characters that changed inside each modified line. A count of removals and additions appears above the result.

How can I compare two texts online for free?

CompareText is free to use with no account, sign-up, or installation. It runs in any modern browser on desktop or mobile. Paste both versions, compare, and click Share if you want a link to the result.

Can I compare two files?

Yes. Open each file, select all, copy, and paste the contents into the left and right boxes. This works for any file you can open as text, from documents and spreadsheets exported as text to source code and configuration files.

How do I share a comparison with someone else?

Click Share above the result. CompareText saves the comparison and shows a link with a random 8-character code that you can copy or send by email. The link expires after 1 month unless you pick 1 hour, 1 day, or never before clicking Share. Anyone with the link sees the same comparison until it expires.

Can I use CompareText to compare code?

Yes. CompareText handles source code, JSON, XML, HTML, CSV, SQL, and configuration files well, and highlights the exact characters that changed within each line. Turn on Subword highlighting to see changes inside identifiers such as getUserName versus getUserNames, and Ignore edge whitespace to skip changes that only affect indentation.

Does CompareText store the text I compare?

Not unless you share it. Your text is sent to our server over an encrypted connection, compared, and returned; it is not saved. When you click Share, the comparison is saved until its link expires (1 hour, 1 day, 1 month, or never) and you get a link with a random 8-character code that anyone with the link can open. Expired comparisons are deleted.

Is there a limit on how much text I can compare?

There is no fixed limit on length for everyday use, and texts with thousands of lines are no problem. Extremely large inputs can hit the time limit for a single comparison. In that case CompareText shows the differences it found so far, notes that the result may be approximate, and offers a more thorough retry.

What is the difference between side-by-side and unified view?

Side by side shows the first version on the left and the second on the right with matching lines aligned, which is the easiest way to read prose and long documents. Unified view stacks both versions into a single column, listing each removed line directly above the line that replaced it. Switch between them with the View option; the comparison itself is identical.

What do the colors and counts mean?

Red marks lines and characters that exist only in the first (left) text, meaning they were removed. Green marks lines and characters that exist only in the second (right) text, meaning they were added. A changed line gets a light tint and the exact characters that differ get a stronger highlight, so a single altered word in a long paragraph stands out. The removal and addition counts above the result are numbers of lines.

Can I compare two documents, PDFs, or emails?

CompareText compares text, so open each document, select all, copy, and paste it into one of the boxes. Only the words are compared, not formatting such as fonts, bold, or images. This works for word processor documents, PDFs, emails, web pages, and anything else you can copy text from.

What does moved block detection do?

When a group of lines is cut from one place and pasted somewhere else, an ordinary diff shows it as a deletion plus an unrelated insertion. CompareText recognizes the block as moved, tells you how many moved blocks it found, and adds Moved links that jump between the old and new positions.

Why are some unchanged lines hidden?

By default CompareText collapses long runs of identical lines and keeps three lines of context on each side of every change, so you can focus on what changed. Click an "unchanged lines" divider to expand it, or turn on Show unchanged lines to see the whole document.