Skip to content
Swizztool

Diff Checker

Compare original and modified text files or code snippets. Highlights additions, deletions, and unchanged lines with line numbers.

Differences

+3 added · −6 removed

1−export function calculateTotal(items) {
2− let sum = 0;
3− for (let i = 0; i < items.length; i++) {
4− sum += items[i].price;
5− }
6− return sum;
1+export function calculateTotal(items: Item[]): number {
2+ // Use modern Array.reduce
3+ return items.reduce((acc, curr) => acc + curr.price, 0);
74}

How to use Diff Checker

  1. Paste the original text into the Left box.
  2. Paste the modified text into the Right box.
  3. Click Compute Differences to view line-by-line additions and deletions.
  4. Review summary statistics for added and removed lines.

About Diff Checker

Compare two versions of text or code and see exactly what changed. Added lines are highlighted green, removed lines red, and each line shows its number in both versions. The comparison updates as you type.

Related tools: JSON Formatter & Validator, Base64 Encoder / Decoder, URL Encoder / Decoder, JWT Decoder

How the comparison works

The checker compares line by line using the longest-common-subsequence method, the same approach Git uses, so moved and edited lines are matched sensibly rather than marking everything after the first change as different.

A line that was edited appears as one removed line followed by one added line. Lines that are identical in both versions are shown without highlighting, and the summary counts how many lines were added and removed.

Tips for clean diffs

Whitespace counts, so a line with a trailing space differs from one without. If you see unexpected changes, run both versions through Remove Extra Spaces first.

Download saves the result as a .diff file with + and - markers, which you can attach to a ticket or email.

Common uses

Contract and document edits
Spot what changed between two drafts of an agreement or policy.
Code review
Compare two snippets or config files without committing them.
Content updates
Check what an editor changed in an article before publishing.
Data checks
Compare two exports or lists line by line.

Questions about Diff Checker

Is comparison data private?
Yes. Differences are calculated locally in your browser memory using an in-memory LCS algorithm.
Does it compare word by word?
It compares whole lines. A changed word shows as the old line removed and the new line added.
Is there a size limit?
Texts of a few thousand lines compare quickly. Very large files may take a moment in your browser.
Can I download the differences?
Yes. Download saves a .diff file with + for added lines and - for removed lines.
Why does an unchanged line show as different?
Usually invisible whitespace, such as a trailing space or a tab instead of spaces. Clean both texts with Remove Extra Spaces and compare again.

Comments

Questions, ideas, or a bug in Diff Checker? Let us know.