plain/devtools home

Text diff checker

Paste two versions and see exactly which lines were added or removed. Copy the result as a unified diff.

tool 10 of 12 []
all shortcuts ?

text-diffsamplesCtrl↵ run · s sample · c copy

never leaves your browser

How to use it

  1. Paste the original text on the left and the changed text on the right, then press Compare.
  2. Removed lines are marked with a minus and a red background. Added lines have a plus and a green background. Unchanged lines are shown for context.
  3. Tick Ignore whitespace to treat runs of spaces and tabs as one space and ignore leading or trailing space, or Ignore case to compare without regard to capitals.
  4. The unified diff box holds the same result in the patch format used by git diff and the patch command, with three lines of context.

Examples

Select an example to load it into the tool.

  • Sampleapple ↵ banana ↵ cherry ↵ date
  • Sample (changed)apple ↵ blueberry ↵ cherry ↵ date ↵ elderberry

Frequently asked questions

What algorithm does it use?

A longest-common-subsequence comparison on lines, after trimming identical lines at the start and end. It finds a minimal set of added and removed lines, which is the same idea behind git diff, though git may pick a different but equally small result when several exist.

Does it compare words or characters inside a line?

No. It works line by line. A line with one changed word shows as one removed line and one added line.

Is there a size limit?

Very large inputs that differ on thousands of lines on both sides are refused with a message, because the comparison grows with the product of the changed line counts. Identical sections at the top and bottom do not count toward that limit.

Is my text uploaded?

No. The comparison runs in your browser. This makes it safe for source code, contracts and logs.

Can I use the output with git apply?

The unified diff has file headers (--- a and +++ b) and hunk markers. Replace the placeholder names a and b with real paths if you want to feed it to patch or git apply.

Related tools

esc
↑↓ move↵ open? all shortcuts

Keyboard shortcuts

Cmd or Ctrl shortcuts always work.
Everywhere
Everywhere
Open the command palette
CtrlK
Open the palette (outside a text field)
/
Show these shortcuts
?
Toggle light and dark theme
t
Go home
gh
Go to all tools
gt
On a tool page
On a tool page
Run the main action
Ctrl↵
Copy the output
c
Load the next sample
s
Focus the input
i
Leave a text field
Esc
Previous or next tool
[]
In the palette
In the palette
Move the selection
↑↓
Open the selected item
↵
Close
Esc