Text Diff Checker & Merge Tool
Compare two texts or code files side by side with every change highlighted, or compare JSON documents, every sheet of two spreadsheets, whole folders, binary files byte by byte and images pixel by pixel; merge changes hunk by hunk; resolve three-way merges; apply patches; export the result as a patch, CSV, Excel workbook or HTML report. Every byte stays in your browser.
Eight comparisons, one page, nothing uploaded
Most diff sites do one thing: a line diff of two pasted texts. Real comparison work is messier than that — a merge that needs a third version, a JSON file whose keys were reordered, a spreadsheet export where one cell changed in ten thousand, a patch file someone emailed, two copies of a project folder, two firmware builds, two screenshots. This page handles each of those with the right algorithm instead of forcing everything through a line diff.
Text & code
Line diff with word- or character-level highlights inside changed lines, syntax colouring for 14 languages, side-by-side or unified layout, context folding, and hunk-by-hunk merge: keep the original or accept the change for each block, then copy, download or send the merged text onward.
Three-way merge
Give it the base version and two edited copies and it merges them the way git merge does: non-overlapping changes from both sides are combined automatically, overlapping ones become conflicts you resolve with a click — ours, theirs or both.
JSON / YAML structure
Compares parsed values, not text. Key order, indentation and quoting style are ignored; what you get is a list of paths — $.config.timeout changed from 30 to 60, $.features[2] added — with arrays matched by position, as sets, or by an id field.
CSV / spreadsheet cells
Rows are matched by up to three key columns you choose, so a re-sorted export does not show as "everything changed". The result is the list of rows added, removed, and changed, with the exact cells that differ and a count per column. Optional rules ignore spacing, case, number formatting (1.0 = 1), date formats and small numeric differences. Every sheet of two Excel workbooks is compared, and the result exports to CSV or to an .xlsx with the changed cells highlighted.
Apply a patch
Paste a unified diff and the file it was made against; the patch is applied with context matching (and a fuzz fallback if line numbers drifted) and the result is shown as a diff so you can see exactly what it did before you trust it.
Folders
Choose or drop two folders, or two zip archives — two releases, a backup and a live copy — and get a tree of added, removed, identical and modified files, compared by content (SHA-256), size or modified date, with an ignore list for folders such as node_modules. Each file is one click from the comparison that suits it: text, table, structure, bytes or image.
Hex / binary
Any two files, byte by byte: offset, hex and text columns for both sides with the differing bytes highlighted, the first differing offset and the number of bytes that differ, next and previous difference, and go to offset. Files are read in slices, so files hundreds of megabytes in size work.
Images
PNG, JPG, GIF, WebP, BMP and SVG side by side, with a slider, onion skin, or a difference image that marks every changed pixel. A tolerance hides re-compression noise, and the result gives the share of pixels that changed alongside the format, dimensions and file size of both images.
Try it with a sample
Each sample switches to the right mode and runs. They are small enough to read in full, so you can check the output against your own expectation.
How the merge works
A diff is a list of hunks — contiguous blocks where the two sides disagree. The merged result starts as the modified text; above each hunk you choose Keep original to revert that block, Accept change to keep it, or Both to include the original lines followed by the modified ones. The merged text updates live, is editable, and can be sent to any other tool.
This is the same operation a code review tool performs when you "accept" or "reject" a suggestion, and the same one you do by hand when reconciling a config file someone edited on the server against the one in the repository. Doing it with explicit per-hunk decisions is faster and less error-prone than copy-pasting lines between two editors, and the exported .patch is a record of exactly what was changed.
Three-way merge, in one paragraph
With only two versions, a tool cannot know which side changed a line — it only knows the lines differ. With a third version, the common ancestor, it can: a line that differs from the base on one side and matches the base on the other was changed by that one side, and the change is taken. If both sides changed the same region differently, neither can be preferred automatically, and that is a conflict. The output uses the same <<<<<<< ours / ======= / >>>>>>> theirs markers as Git (plus the base in ||||||| diff3 style), so it drops straight into any editor that understands them — or resolve each conflict here with one click.
What a diff is actually computing
Comparing two blocks of text is not a character-by-character scan. A diff algorithm looks for the longest common subsequence — the largest set of lines appearing in both versions in the same order — and everything outside that becomes an addition or a deletion. That framing explains most of the behaviour people find surprising.
It is why moving a block of code often shows as a large deletion plus a large insertion rather than "moved": a line-based diff has no concept of movement, only of presence and position. And it is why inserting one line near the top can shift how everything below it aligns, if the algorithm finds a cheaper way to match the remaining text.
Invisible differences
The hardest diffs are the ones you cannot see: a trailing space, a tab where the rest of the file uses spaces, a non-breaking space pasted from a document, or a zero-width character from a web page. Turn on Show whitespace to render spaces and tabs visibly and every invisible character as a labelled marker (NBSP, ZWSP, BOM, RLO and so on); inside a changed region those markers appear even with the option off, so a change is never invisible. The Unicode Inspector explains any character in detail.
Line endings
Windows uses CRLF, Unix LF. A file that has crossed platforms without normalisation differs on every line while looking unchanged. Lines are matched ignoring the line ending, so that case does not show as a wall of red; instead the result says plainly that the line endings differ, and a merged download keeps the file's own line endings.
Unicode that looks the same
A Cyrillic а renders identically to a Latin a. So do curly and straight quotes after a word processor has been involved. Normalisation form matters too: é can be one code point or e plus a combining accent, and the two are different strings.
Where a text diff is the right tool
Version control handles diffing committed code, so the useful cases for a standalone comparison are the ones outside a repository:
- Configuration drift. Comparing the config actually running on a server against what the repository says should be there — the single most common source of "works on staging, fails in production".
- Environment variable sets. Two
.envfiles where one key differs, or one is missing entirely. - API responses before and after a change. Confirming that a refactor altered only what you expected — use the structural mode so formatting differences vanish.
- Content and copy review. Finding what changed between two versions of a document when nobody tracked changes. Word granularity is the readable choice for prose.
- Log comparison. A successful run against a failing one, to isolate where the behaviour diverges. Ignore-whitespace plus context folding keeps it readable.
Why two files that look identical still differ
The most frustrating diff is the one that reports a change you cannot see. Almost always the difference is a character that renders as nothing, or as the same thing your editor renders something else as. Four causes account for nearly all of these.
Line endings. Windows terminates a line with CRLF (carriage return plus line feed), Unix and macOS with a bare LF. A file that has travelled through a Windows editor, a zip archive, or a checkout with Git's core.autocrlf enabled can differ from its counterpart on every single line while looking identical on screen. This tool matches lines regardless of their endings and tells you separately when the endings differ; if a diff elsewhere marks an entire file as changed, check the line endings before you check anything else.
Trailing whitespace. A space or tab at the end of a line is invisible in most editors and significant to a byte-for-byte comparison. It is also the change most often introduced accidentally, because pressing space before a newline leaves no visual trace. Use the Trim trailing option to confirm that this is the only difference, then remove the whitespace rather than leaving the option on permanently — it will hide a real change eventually.
Unicode normalisation. The character é can be stored as a single code point (U+00E9) or as e followed by a combining acute accent (U+0065 U+0301). Both render identically in every font. They are different byte sequences, so they are a difference. macOS filesystems have historically preferred the decomposed form, which is why filenames with accents copied from a Mac can mismatch a list generated on Linux.
Invisible and look-alike characters. A zero-width space (U+200B), a non-breaking space (U+00A0) pasted from a web page or a word processor, a byte-order mark at the start of the file (U+FEFF), or a Cyrillic а standing in for a Latin a all produce a change with no visible cause. The BOM case is particularly common: it is three bytes prepended to a UTF-8 file by some Windows tools, and it breaks shebang lines, YAML documents and JSON parsers while remaining completely invisible in an editor.
When a difference refuses to explain itself, the fastest resolution is to stop looking at the rendered text and look at the bytes. cat -A file on Linux marks line endings with $ and tabs with ^I; xxd file | head shows you the raw hex, including a leading efbbbf BOM. Once you know which character it is, the fix is usually a single editor setting away.
Line diff, word diff, character diff
The same two inputs can produce three very different-looking comparisons depending on the granularity the algorithm works at, and choosing the wrong one is why a diff is sometimes unreadable.
Line granularity treats each line as one indivisible unit: a line either matches or it does not. This is what git diff and code review tools show by default, and it is the right default for source code, where a line is roughly a statement and changing part of a line means the whole line needs re-reading. Its weakness is prose. Reflow a paragraph so the words wrap differently and a line diff reports every line as changed even though only one word moved.
Word granularity splits on whitespace, so a reflowed paragraph shows only the words that actually changed. This is what you want for documentation, translated strings, legal text and anything else written to be read by people rather than parsed by a compiler. It is a poor fit for minified code or long identifiers, where a word can be hundreds of characters long.
Character granularity compares individual characters. It is the only mode that will show you that getUserId became getUserID, or that a single digit changed in a long hash. It is also the noisiest: on two genuinely different paragraphs it produces a mosaic of tiny insertions and deletions that is harder to read than seeing the old and new text side by side.
The practical rule is to start at line level to see the shape of the change, then narrow to word or character level on the specific lines that report a difference you cannot account for. This page does exactly that: changed lines are identified first, then the changed regions inside those lines are highlighted at the granularity you pick. That two-stage presentation is why a good diff is readable at all — you get the structure from the coarse pass and the detail from the fine one, without drowning in either.
Engineering FAQ
The engine first runs a line-level diff to find which lines changed. Where a block of removed lines is immediately followed by a block of added lines, it pairs them up and runs a second diff inside each pair at word or character granularity, highlighting only the parts that actually differ. Lines that were purely added or removed are shown whole.
They change how lines are compared, not how they are displayed. Ignore whitespace collapses every run of spaces and tabs to one space and trims the ends, so a reformatted file shows only logic changes. Ignore case compares lower-cased lines. Trim trailing ignores whitespace at the end of a line only. Ignore blank lines leaves empty lines out of the comparison. Lines are always matched regardless of CRLF or LF endings, but a difference in line endings, or a missing newline at the end of a file, is still reported above the result. The original text is shown in full.
Run a text comparison, then use the controls above each change block: Keep original, Accept change, or Both. The Merged result pane below the diff updates as you decide, starting from the modified text with every change accepted. You can also edit the merged text directly, copy it, download it, send it to another tool, or load it back as the new original to continue from there.
When two people (or two branches) edited the same file independently and you have the version they both started from. A two-way diff cannot tell which side changed a line; with the base it can, so non-overlapping edits from both sides merge automatically and only genuine overlaps become conflicts. The output uses Git's conflict markers with diff3-style base sections, and each conflict can be resolved in place with ours, theirs, or both.
A structural diff parses both documents and compares the resulting values. Two JSON files with the same data but different key order, indentation or quoting show no difference, and the changes that do exist are reported by path, like $.server.port changed from 8080 to 443. Use it for configuration files, API responses and anything machine-generated. Use the text diff when formatting itself matters, such as reviewing a hand-edited file.
By up to three key columns you choose from the header row, such as an id, or a region plus a SKU. Rows with the same key are compared cell by cell regardless of where they appear, so a re-sorted or filtered export shows only real changes. Rows whose key exists on one side only are reported as added or removed, duplicate keys are flagged, and columns that appear or disappear are listed separately. Matching options can trim spaces, ignore case, treat empty and NULL alike, compare numbers by value, read dates in different formats as the same date, allow an absolute or percentage tolerance, and leave chosen columns out. If the file has no natural key, match by row order instead.
Yes. Open an .xlsx, .xls or .ods file on each side and every sheet is compared: sheets with the same name are paired, a sheet that was renamed is paired by its content and marked as possibly renamed, and sheets found on one side only are listed. A summary shows the changes per sheet, with a tab for each. You can compare the values as Excel displays them (with number and date formats applied) or the raw stored values, and the whole comparison exports to one .xlsx.
Yes. The export is a standard unified diff with --- and +++ headers and @@ hunk ranges, which git apply, patch -p0 and every code review tool accept. The Apply a patch mode reads the same format back, including patches produced by git diff, and uses context matching with a fuzz fallback when line numbers have drifted.
No. Files and folders are read by the browser itself, zip archives are unpacked with the browser's own DecompressionStream, folder contents are hashed with the browser's Web Crypto, and every algorithm on this page is JavaScript running in the tab. The privacy indicator in the header counts any network request the page makes; it stays at zero while you work. Nothing is stored either: the Save to history switch next to Compare is off by default. If you turn it on, each comparison you run with the Compare button is kept in this browser's own storage so you can reopen it later; edits made while typing are never saved, and the history can be cleared at any time. Apart from that, only two settings are remembered: the folder ignore list and whether the history switch is on. Closing the tab otherwise discards everything.
Large text files are compared in a background worker with a progress bar and a Cancel button, so the page never freezes, and the result is drawn as a virtual list: only the rows on screen exist in the page, so a 100,000-line comparison scrolls like a short one. When two large files are too different to line up within a time limit, the page says so and shows what they have in common, with an option to align them anyway. The hex view reads files in slices, so two files of hundreds of megabytes compare without being loaded into memory, and folders of tens of thousands of files are hashed in the background. Images larger than 40 megapixels are compared on a scaled copy, and the page says so. Share links are capped at roughly 60 KB of compressed input; larger comparisons can be exported instead.
Both files are read in 4 MB slices and compared byte for byte at the same offsets; no alignment is attempted, because in a binary file an inserted byte usually means everything after it moved. The result gives both sizes, the number of bytes that differ, the number of separate differing ranges and the first differing offset, and warns when the sizes differ (the extra bytes count as different). The view shows offset, hex and printable text for both sides with the differing bytes highlighted; Next and Previous step through the ranges, and Go to offset accepts hex (0x1F00) or decimal (7936). The ranges export as CSV.
Both images are decoded by the browser and drawn at the same position, top-left aligned. A pixel counts as changed when its red, green, blue or alpha value differs by more than the tolerance, so a tolerance of a few levels hides JPEG re-compression noise while still catching real edits; fully transparent pixels count as equal whatever their colour. If the dimensions differ, the page warns you and counts the area only one image covers as changed. SVGs are compared as rendered, and their source can be compared as text with one click. The format is read from the file's bytes, so a PNG saved with a .jpg name is reported as a PNG.
Text comparisons export as a unified .patch and an HTML report. Tables export as CSV, with an original and a modified column for every column, and as an .xlsx with changed cells yellow, added rows green and removed rows red. JSON and YAML changes export by path as CSV or JSON, folders as CSV or HTML, byte comparisons as a CSV of the differing ranges, and images as an HTML report with both images and the difference image, or the difference image alone as a PNG. Every report starts with the names of what was compared, the options used and the date it was made.
Deployment Changelog
- v4.1.0 Applying a multi-file patch: the live update after typing keeps you on the file you are viewing instead of jumping back to the first, and a fuzzy match you confirmed stays confirmed unless that file's original changes.
- v4.0.0 Folder comparison of real folders (choose, drop or zip) with a tree, content, size or date matching and an ignore list; every sheet of two workbooks compared; up to three key columns and matching options for tables (trim, case, empty = NULL, numbers by value, date formats, tolerance, ignored columns) with filters, sorting and per-column counts; a hex view for binary files of any size; image comparison with slider, onion skin and pixel difference; CSV, .xlsx and JSON exports that state the options and date. Fixed 20 bugs, including: files in Windows-1252 and UTF-16 are decoded instead of garbled, JSON numbers beyond 2^53 compare exactly, duplicate keys are reported, large or unrelated files no longer freeze the page, line-ending and final-newline differences are reported, invisible characters are labelled, and history is saved only when you ask for it.
- v3.0.0 Rebuilt as a merge tool: hunk-by-hunk merge with a live editable result, three-way merge with conflict resolution, structural JSON/YAML diff, keyed CSV and Excel cell diff, apply-a-patch mode, zip folder comparison, syntax highlighting for 14 languages, context folding, unified patch and HTML report export, show-whitespace, ignore-case/trailing/blank options, keyboard navigation and share links.
- v2.3.0 Added a highlight granularity control for changed lines: word (default), character, or none.
- v2.2.0 Added file upload and drag-and-drop to both panes.
- v2.1.0 Integrated Quick Testing Templates for rapid forensic evaluation.
- v2.0.0 Major Engine Overhaul: Integrated high-performance
jsdifflibrary for exact character-level forensic highlighting. - v1.3.0 Added "Inline vs Split View" rendering modes for easier mobile debugging.
- v1.2.0 Integrated "Next/Prev Diff" navigation to jump directly to code changes in large files.
- v1.1.0 Added "Ignore Whitespace" toggle.