Skip to content

Text Diff - Compare Two Texts Side by Side

Original text
Modified text

Compare Two Texts

Paste the original text on the left and the changed version on the right. Removed lines are marked in red, added lines in green, and when a line was edited rather than replaced, the words that changed inside it are highlighted too. A summary shows how many lines were added, removed and left unchanged. Nothing is uploaded; the comparison runs in your browser.

Example

Original:

timeout = 30
retries = 3
log_level = info

Changed:

timeout = 60
retries = 3
log_level = debug
cache = on

The diff shows two edited lines, with 30 → 60 and info → debug highlighted, one unchanged line, and cache = on as an added line.

Views and Options

  • Side by side lines up the two versions in columns, which is easiest for prose and config files. Unified shows one column with removed lines above added ones, the layout of git diff.
  • Ignore whitespace treats lines that differ only in spacing or indentation as equal. Ignore case treats "Hello" and "hello" as the same line.
  • Collapse unchanged lines folds long identical stretches down to three lines of context around each change. Click a folded section to open it.

When a Line Diff Is the Wrong Tool

A line-based diff sees a re-wrapped paragraph as every line changed, because the line breaks moved. Join the lines first with Remove Line Breaks, or compare paragraph by paragraph. For two lists where order does not matter, use List Diff, which reports items only in one list or in both. For JSON, the JSON diff compares structure and ignores key order and formatting.

Related Tools

Frequently Asked Questions

How do I ignore indentation or spacing changes?
Tick Ignore whitespace. Lines are then compared after collapsing runs of spaces and tabs to one space and trimming both ends, so re-indented code or a doubled space no longer shows as a change. The output still shows the original text.
Will Windows and Unix line endings show as differences?
No. Both texts are split on either \r\n or \n, so a file saved with CRLF endings and the same file with LF endings compare as identical. Trailing spaces at the end of a line do count, unless Ignore whitespace is on.
What diff algorithm does it use?
A line-based longest common subsequence (LCS) diff, after first skipping the lines that match at the start and end. Within each pair of changed lines, a second LCS pass on words picks out exactly which words changed. Git's default Myers algorithm solves the same problem in a different way, so results are usually the same, though the two can choose differently when several lines repeat.
Can it handle large texts?
Files of several thousand lines compare in well under a second, because only the changed middle section is compared line by line. If the changed section is enormous (roughly 3,000 changed lines on each side or more), the tool stops looking for matching lines inside it and shows the whole block as removed and then added, so the page does not freeze.
How is this different from the JSON Diff tool?
Text Diff compares lines, so reordered keys or re-indented JSON show up as changes. JSON Diff parses both inputs and compares the data, so {"a":1,"b":2} and {"b":2,"a":1} count as equal and you see changes as paths like $.user.email. Use JSON Diff for API responses and config objects, and Text Diff for everything else.