Pack Camo

Diff Checker: Compare Two Texts

Compare two texts and see every added, removed and changed line. كل شيء يعمل محليًا — لا يُرفع أي شيء.

الإدخال
Two texts or files
الإخراج
Side-by-side · inline · unified diff

Original

pane.lines

Changed

pane.lines

Differences

stats.added · stats.removed · stats.changed

1Pack Camo diff checker1Pack Camo diff checker223Paste the original text on this side.3Paste the original text on this side.4The changed version goes on the right.4The edited version goes on the right.5Lines that match are folded away.5Lines that match are folded away.667Timeout: 30 seconds7Timeout: 45 seconds8Retries: 38Mode: strict9Mode: strict9Log level: debug

Compare text and see exactly what changed

Paste the original on the left and the changed version on the right, or drop a file onto each side, and this diff checker lines the two up and marks every line that was added, removed or changed. Inside a changed line the words or characters that differ are highlighted, so a moved comma or a changed number does not hide in a long sentence. The comparison runs entirely in your browser, which makes it safe for contracts, configuration files and code you would rather not paste into somebody's server.

How to compare two texts

  1. Paste the original text into the left box and the changed text into the right one, or drop a text file onto either box.
  2. Read the result below: removed lines are red, added lines green, and the words that changed inside a line are highlighted.
  3. Switch between side by side and unified views, and ignore whitespace, letter case or blank lines when they do not matter.
  4. Use the arrows to jump from one change to the next.
  5. Copy or download the differences as a standard .patch file to apply with git apply or patch.

How the comparison works

The texts are compared line by line with the Myers difference algorithm, the same algorithm behind git diff and GNU diff. It finds the shortest list of insertions and deletions that turns one text into the other, which is the same as finding the longest run of lines the two have in common. Lines that were edited show up as a removal followed by an addition; the tool pairs them up and runs a second, finer comparison inside each pair, word by word or character by character, to highlight just the part that changed.

Unchanged stretches are folded away with three lines of context around each change, as in a code review. Click a folded stretch to open it, or turn folding off to see both texts in full. Very large or almost completely different inputs are still compared quickly: past a work limit the tool reports the remaining region as one block of changes instead of searching for the smallest possible diff, and it says so above the result.

Ignoring whitespace, case and blank lines

Ignore whitespace
Lines that differ only in spaces, tabs or indentation count as equal, like git diff -w. Useful after reformatting code or re-wrapping text.
Ignore case
Upper and lower case letters compare as equal, so a heading changed from Title Case to sentence case is not flagged.
Ignore blank lines
Changes that only add or remove empty lines are greyed out and left out of the counts and the patch.
Words or characters
Choose how finely changed lines are highlighted: whole words suit prose, single characters suit code, IDs and numbers.

Side by side or unified view

The side by side view puts the original and the changed text in two columns with their own line numbers, aligned so that a changed line sits next to its new version. It is the easiest view for reading prose and for long lines. The unified view shows one column, with removed lines marked - and added lines marked +, exactly as a patch file or a pull request shows them; it works better on a narrow screen.

The counts above the result give added, removed and changed lines. A changed line is one that was edited in place; a removed line has no counterpart in the new text.

Line numbers on both sides refer to the texts exactly as you pasted them, so you can find each change in your own editor. The arrows above the result step through the changes in order and centre each one; the counter shows which change you are on.

Patch files and other formats

The download is a unified diff: --- and +++ headers naming the two files, then @@ hunks with three lines of context, the format read by git apply, patch -p1 and every code review tool. It marks a missing newline at the end of a file the standard way, so applying the patch to the original reproduces the changed text exactly.

For JSON, a line diff is often the wrong tool: reordered keys or a re-indented file look like changes everywhere. The JSON diff tool compares the structure instead and ignores key order and formatting. To count the words in either version, use the word counter.

الأسئلة الشائعة

How do I compare two texts for differences?
Paste the original text into the left box and the new version into the right box. The differences appear immediately below, with removed lines in red, added lines in green and changed words highlighted.
Can I compare two files?
Yes. Drop a text file onto each box, or paste their contents. Any plain-text file works, including code, CSV, Markdown, logs and configuration files.
How do I ignore whitespace differences?
Turn on Ignore whitespace. Lines that differ only in spaces, tabs or indentation are then treated as equal, like git diff -w.
What is a unified diff?
A unified diff lists changes as hunks starting with @@, with removed lines prefixed by a minus sign, added lines by a plus sign and a few unchanged lines of context. It is the format used by git and the patch command.
How do I create a patch file from two texts?
Compare the texts, then press the download button to save a .patch file in unified format. Apply it to the original with git apply or patch -p1.
Is there a size limit?
No fixed limit. Files of tens of thousands of lines compare in a fraction of a second. For very large or completely different inputs, word highlighting is switched off and the diff may group changes into larger blocks to stay fast.
Is the text I compare uploaded anywhere?
No. The comparison runs in your browser and nothing is sent to a server, so it is safe to compare private documents and code.