Skip to main content

Text diff

Compare two texts or code snippets with line, word, or character-level highlighting.

Free & unlimited
Original
Modified
Layout
Granularity
0 / 0
All processing happens in your browser. No data is sent to any server.

Paste an old version on the left and a new one on the right and the differences are highlighted immediately — added lines in green, removed in red, and inside a changed line the exact words or characters that moved. You get a similarity percentage, a jump-to-next-change control, and the option to export the result as a .patch file. Both texts stay in the browser; there is no upload and no diff is ever stored.

Key facts about Text diff

Key facts about Text diff
GranularityLine, word or character — word level is the default for prose, line for code
LayoutsSide by side, unified, and inline
Diff algorithmMyers diff via the `diff` library, the same family of algorithm git uses
Similarity scoreUnchanged lines as a percentage of total lines — 100 % means byte-identical after any folding you enabled
Noise controlsIgnore case, ignore whitespace, and collapse runs of more than three unchanged lines
NavigationJump between change hunks with the arrows, or press j and k
InputPaste, clipboard button, or load a file — .txt, .json, .js, .ts, .py, .html, .css, .md, .yml, .xml, .csv, .sql, .sh, .go, .rs, .java, .c, .cpp, .rb, .php
ExportCopy the diff as text, or download it as a .patch file

What happens to your file

Both texts are diffed by JavaScript in this tab. Loading a file uses the File API, which reads the file from disk into the page — it is not an upload, and no request is made. Nothing is sent to a server, nothing is written to storage, and the comparison disappears when you close the tab. That is the difference between this and pasting a configuration file into a hosted diff service.

About this tool

  1. 1

    Paste the original

    Left pane. Use the Paste button to pull it straight from the clipboard, or Upload to load a file from disk.

  2. 2

    Paste the modified version

    Right pane. Swap the two with the swap control if you pasted them the wrong way round.

  3. 3

    Choose layout and granularity

    Side by side for code, unified for a patch-style read, inline for prose. Then line, word or character.

  4. 4

    Filter the noise

    Turn on ignore whitespace or ignore case, and collapse unchanged runs, so only the real changes are left.

  5. 5

    Navigate and export

    Step through the hunks with the arrows or j/k, then copy the diff or download it as a .patch.

Specs & compatibility
Max sizeNo hard limit; word- and character-level diffs on files over a few hundred KB get slow because the work is quadratic in the worst case
Line endingsCRLF and LF are both accepted; turn on ignore whitespace to stop a line-ending change reporting every line as modified
SyntaxLanguage-agnostic — it compares text, so it works equally on JSON, YAML, prose or a CSV
Browser supportAny modern browser. The Paste button needs clipboard permission; typing or dragging always works
NetworkNone after page load
  • If every line shows as changed, the two files have different line endings — switch on ignore whitespace.
  • Word granularity is what you want for prose; line granularity is what you want before a commit.
  • Collapse unchanged lines on a long file: three lines of context either side of each hunk is usually enough to read a change.
  • The .patch export is plain text in unified style — handy for pasting into a review, though it is not a git-applicable patch header.
  • j and k step forward and back through changes without touching the mouse, as long as focus is outside the textareas.
  • Line, word and character-level highlighting
  • Side-by-side, unified and inline layouts
  • Similarity percentage and added/removed counts
  • Ignore case and ignore whitespace
  • Collapse unchanged runs
  • Keyboard hunk navigation (j / k)
  • Load from file, copy diff, download .patch
  • See exactly what changed between two versions of a source file before committing.
  • Compare a staging and a production config without pasting either into a hosted service.
  • Check what an editor altered in a contract or a policy document.
  • Confirm a refactor produced byte-identical output by diffing the two results.
  • Find the one changed value inside two large JSON responses.
No. The comparison runs in this browser tab and the page makes no network request after it loads. Even the Upload button is local: it uses the File API to read the file from disk into the page, it does not send it.
Unchanged lines divided by total lines, after any ignore-case or ignore-whitespace folding you turned on. It is a rough closeness measure, not a plagiarism score.
Line for code and configuration, because that matches how you will apply the change. Word for prose, so a reworded sentence does not read as a wholly new line. Character for spotting a single wrong digit or a stray unicode look-alike.
Almost always line endings: one file is CRLF and the other LF. Enable ignore whitespace and the real change appears on its own.
There is no imposed cap, but word- and character-level diffing is expensive. Files up to a few hundred kilobytes are comfortable; beyond that, switch to line granularity first.
Here. It offered the same three layouts, the same three granularities and the same similarity score, and this page additionally loads files, folds whitespace and case, and exports a patch — so there was nothing to port, only a URL to redirect.
View all

Updated

We use anonymous analytics to improve ToolChamp. No personal data is stored or sold. Privacy Policy