{ } Format & Compare

Text Diff — Compare Two Texts Side by Side

Compare two texts by line, word or character with side-by-side and unified views, whitespace/case/line-ending options, Unicode normalization and .patch export.

Line / word / char CRLF & Unicode checks Unified .patch export Runs in a worker

Loading Text Diff…

What this page sends

  • Your input: Processed in this tab and not sent to a server.
  • Page load: Loading the page requests HTML, scripts and images from ByteKiln, fonts from Google Fonts, and sends Google Analytics page views, tool-usage events and catalog interactions (tool/category IDs, result status and whether a click followed search — never your input, output or search terms). Privacy & sharing

How the Text Diff — Compare Two Texts Side by Side Works

A text diff is simple until it isn't: two config files that look identical but "every line changed", a contract where one clause moved, a log that differs only by a non-breaking space. This tool compares two texts by line, word or character, using the jsdiff library in a background Web Worker so large inputs don't freeze the page. Before diffing, it checks for the differences you can't see: CRLF versus LF line endings, a missing final newline, byte order marks, non-breaking and zero-width spaces, tabs, and Unicode normalization — and tells you about them in plain words instead of showing a wall of red. You can ignore whitespace, case and line endings, normalize Unicode to NFC, and make whitespace visible. Line mode has a side-by-side view with changed words highlighted inside changed lines, a unified view, next/previous navigation, and export as a standard unified .patch file.

Algorithm

jsdiff implements Myers' O(ND) diff, the same algorithm family as git diff. In line mode, a run of removed lines followed by added lines is paired up row by row, and each pair is diffed again by words so you see exactly what changed inside the line.

Options

"Ignore whitespace" ignores leading and trailing whitespace in line mode and whitespace-only edits in word mode. "Ignore case" compares case-insensitively. "Ignore line endings" treats CRLF, CR and LF as the same. "Normalize Unicode" converts both texts to NFC first. A missing newline at the very end is reported but not counted as a changed line.

Views

Side by side shows the original and changed text in aligned rows; unified shows removed lines (−) above added lines (+). Long runs of unchanged lines are collapsed to three lines of context, as in git diff. Next and previous jump between blocks of changes.

Patch export

The .patch file is a unified diff with three lines of context and a/ b/ file headers. It uses the same line-ending and whitespace options you chose, so what you see is what the patch contains.

Limitations

  • It is a two-way diff: no three-way merge or conflict markers.
  • Line mode can't detect moved blocks; a moved paragraph is shown as removed in one place and added in another.
  • Binary files and images aren't compared, and very large inputs are slower in character mode than in line mode.
  • The .patch export uses a/ and b/ file names you can apply with git apply or patch, but it has no real file paths or index lines.

FAQ

Short answers for the things developers usually ask before trusting a tool.

Is my text uploaded?

No. The diff runs in a Web Worker inside your browser. Nothing you paste is sent anywhere, which matters when you're comparing config files, logs or contracts.

Why does every line show as changed?

Usually line endings: one file uses Windows CRLF and the other Unix LF. The tool detects this and says "the texts differ only in line endings" instead of marking every line. "Ignore line endings" is on by default; turn it off if the endings themselves matter.

The texts look identical but the tool says they differ. Why?

Invisible characters. Common culprits are a byte order mark at the start, non-breaking spaces from word processors, zero-width spaces, tabs versus spaces, a missing final newline, or accented letters stored in different Unicode forms (é as one code point versus e plus a combining accent). The tool lists which of these it found on each side; "Show whitespace" and "Normalize Unicode (NFC)" help confirm it.

What is the difference between line, word and character mode?

Line mode compares whole lines — best for code and config, and the only mode that can produce a patch. Changed lines are paired and the changed words inside them highlighted. Word mode shows insertions and deletions inline, which suits prose. Character mode finds the smallest edits, useful for IDs, hashes and single-line values.

Can I apply the diff as a patch?

Yes. "Download .patch" saves a unified diff with a/ and b/ paths that git apply, patch -p1 and jsdiff's applyPatch accept. The export is tested by applying it back to the original.

How large can the texts be?

Hundreds of thousands of lines work, because the diff runs in a background worker and doesn't freeze the page. Above 50,000 lines only line mode is offered, and very different large files can take a few seconds.

Related tools

Useful follow-ups when one conversion usually turns into three more.