Skip to content

Diff Checker: Compare Text and Code

Paste two versions of a text, config or source file and see what changed, line by line. Added, removed and edited lines are color coded in a side-by-side view.

Upload Left Code

Drop or select the original / old / source code file.

old code · source version

Upload Right Code

Drop or select the updated / new / target code file.

new code · updated version

Diff Controls

Waiting for two code inputs
Ready. Paste or upload two code snippets to compare.
StatusWaiting
Total Rows0
Added0
Removed0
Changed0
Unchanged0
LanguageAuto

Source Code Editors

Left idle Right idle Diff idle

Left / Old Code

0 chars 0 lines
Waiting for left code
No left file

Right / New Code

0 chars 0 lines
Waiting for right code
No right file

Side-by-Side Diff

Viewer idle
Left / Old
REMOVED CHANGED
1
Compare two snippets to render the diff here.
Right / New
ADDED CHANGED
1
Compare two snippets to render the diff here.
Purple rows mean both sides exist but the content changed. Green means only the right side has that line. Red means only the left side has that line.

Detailed Diff Report

Report idle
No diff report yet.

Runs in your browser. Nothing you type, paste or open here is uploaded.

To compare two texts, paste the original into Left / Old Code and the new version into Right / New Code, or upload two files, then select Compare Code. The tool matches lines that are the same on both sides and marks the rest: red for removed, green for added and purple for lines that were edited.

How to compare two texts with the diff checker

  1. Add both versions. Paste the old text on the left and the new text on the right, or use Select Left File and Select Right File. It reads .txt, .js, .py, .html, .css, .json, .xml, .yml, .sql, .md and other plain-text files.
  2. Set the rules. Tick Ignore whitespace differences or Ignore case if those changes don't matter. Set Context to Only changed ±4 to hide long unchanged stretches.
  3. Run the diff. Select Compare Code or press Ctrl+Enter in either editor. The Side-by-Side Diff and the Detailed Diff Report fill in, and the counters show added, removed, changed and unchanged lines.
  4. Export it. Select Copy Diff Report or Download Report to save code-diff-report.txt with every change and its line numbers.

How the diff checker matches lines

The tool splits both inputs into lines and finds the longest common subsequence: the largest set of lines that appear on both sides in the same order. Those lines are unchanged. Every other line on the left was removed, and every other line on the right was added. When a removed line sits directly next to an added one, the pair is shown as a single changed line, with the part that differs highlighted inside it.

For example, compare this config:

Left                 Right
host = localhost     host = localhost
port = 8080          port = 9090
debug = true         debug = true
                     timeout = 30
LineResultColor
1 and 3UnchangedNone
2Changed: 8080 became 9090Purple
4 (right only)AddedGreen

Line numbers on each side refer to that side's own file, so you can jump to the exact spot in your editor.

Code diff checker options

  • Ignore whitespace differences collapses runs of spaces and tabs and trims each line before comparing, so port = 8080 matches port = 8080. Text that differs only by a missing space, such as a=b vs a = b, still counts as changed.
  • Ignore case treats SELECT and select as the same line, handy for SQL and HTML.
  • Context shows every line by default. The ±2, ±4 and ±8 settings keep only changed lines and their neighbors, and replace the rest with a "hidden line(s)" marker.
  • Find in diff filters the view to rows whose text or line number contains what you type.
  • Syntax Highlight guesses the language from the content, or you can force JavaScript/TypeScript, HTML/XML, CSS/SCSS, JSON or plain text.

Sync left and right scroll is on by default, so both panes move together. Turn on word wrap for long lines such as minified CSS or log entries.

Comparing XML, JSON and other structured text

A line diff is only as good as the line breaks. Two XML files that each sit on one line show up as one changed line, even if a single attribute differs. Run both through the XML formatter first so every tag has its own line, then compare. That turns this page into a usable XML diff checker.

For JSON, a text diff also flags key order and indentation. If you only care about the values, the JSON compare tool matches keys and reports changes by path, such as users[0].role.

Online diff checker vs diff and git diff

On a machine with a terminal, diff -u old.txt new.txt prints a unified diff, with removed lines starting with - and added lines with +. git diff --no-index old.txt new.txt does the same for any two files, even outside a repository. Both are good for scripts and patches.

This page is quicker when you need to compare text that came from an email, a ticket or a web form, when you want a side-by-side view, or when you're on a phone. It runs in your browser, so pasted code and configs are not uploaded. The comparison table grows with the line count of both sides, so it works best on files up to a few thousand lines each; very large files can make the tab slow.

Frequently asked questions

How do I compare two texts for differences?

Paste one text into the left box and the other into the right box, then select Compare Code. Removed lines are red, added lines green and edited lines purple.

Can I ignore spaces and indentation when comparing?

Yes. Tick Ignore whitespace differences. Extra spaces, tabs and trailing whitespace are then ignored when lines are matched.

Does it compare by word or by line?

By line. Lines are matched first, and when a line was edited, the differing part inside that line is highlighted.

Can I compare two files instead of pasting text?

Yes. Use Select Left File and Select Right File, or drag a file onto each upload box. Any plain-text file works, including code, CSV, logs and Markdown.

Is this text compare tool private?

Yes. Both texts are compared in your browser with JavaScript and never sent to a server.

What keyboard shortcuts does it support?

With the cursor in either editor, Ctrl+Enter (Cmd+Enter on a Mac) runs the comparison. Clearing and downloading use the Clear All and Download Report buttons, so your browser keeps its own Ctrl+L and Ctrl+S shortcuts.

Updated 11 October 2026Reviewed by the ToolzyLab teamHow we test our tools