Text / Code Diff

Your data never leaves your browser

Compare two text blocks with line-by-line diff. Additions highlighted green, removals red. Unchanged sections collapse automatically.

Original
Modified
Paste text into both panels to compare
Ctrl+Shift+CCopy diffCtrl+KClearDiff updates as you type

Share this tool

Found it useful? Help a fellow developer discover it.

https://developertoolkit.dev/tools/diff-checker

How to use

  1. Paste your original text in the left panel and the modified text in the right panel.
  2. The diff updates automatically as you type. Use Line diff for line-by-line comparison or Word diff to see changes at the word level.
  3. Added lines are highlighted in green with a + prefix. Removed lines are highlighted in red with a prefix.
  4. Long runs of unchanged lines collapse automatically. Click the ellipsis row to expand them.
  5. Use Copy Diff to copy the diff in unified format (+/-/space prefixes).

Line diff vs. word diff

Line diff

Each line is compared as a unit. A line is either added, removed, or unchanged. Best for code, configuration files, or any content where lines are meaningful units. This is the mode used by git diff and most version control systems.

Word diff

Individual words are compared. Useful for prose, documentation, or any content where you want to see exactly which words changed within a paragraph rather than which entire lines changed.

When to use a text diff checker

Frequently Asked Questions

How do I compare two text files online?

Paste the original text into the left panel and the modified text into the right panel. The diff updates automatically as you type. Toggle between Line diff and Word diff modes depending on how granular you need the comparison. Use Copy Diff to copy the result in unified format for use elsewhere.

What is the difference between text diff and JSON diff?

Text diff compares any two texts line by line. It treats JSON as plain text, so reformatting or reordering keys appears as changes even when the data is semantically identical. JSON Diff parses the structure and compares semantically, so key order and whitespace changes produce no output. Use text diff for comparing exact file contents and JSON Diff for comparing data.

Can I save or share my diff result?

Use the Copy Diff button to copy the diff in unified format. You can paste this into a GitHub comment, a Slack message, a document, or a .patch file. The unified format (lines prefixed with + and -) is widely understood and displays clearly in monospace fonts.

Does whitespace matter in the comparison?

Yes, by default. A line with a trailing space and the same line without it are treated as different. This matches the behavior of git diff and most code comparison tools. If you want whitespace-insensitive comparison, trim your input before pasting.

Can I compare code files?

Yes. Paste the entire file contents into each panel. The diff engine treats any text as plain text with no language awareness. The output is equivalent to running git diff --unified on two files.

What algorithm does this use?

The diff uses the Myers diff algorithm, the same one used by git diff and GNU diff. It finds the shortest edit script (minimum number of additions and removals) needed to transform the left text into the right text.

What is the output of Copy Diff?

Copying produces a simplified unified diff: lines prefixed with + (added), - (removed), or a space (unchanged). All lines are included without context collapse. This format is compatible with patch files and is human-readable without any additional tooling.

Does this send my text to a server?

No. All diffing runs in your browser using the open-source jsdiff library. Paste production config files, SQL schemas, and private API responses without concern.

Related Tools