Git-Like Text Diff Tool
Paste two versions of any text or upload two files to see a unified, git-style diff. Added lines appear with +, removed lines with −, and three unchanged context lines surround every change while longer unchanged stretches are folded, similar to the layout you see in git diff and GitHub pull requests. All diffing runs in your browser using a Web Worker so the page stays responsive on large inputs.
How it works
Both texts are handed to a Web Worker so the page stays responsive, and the worker splits them into lines with Windows line endings normalised. Lines that match at the start and end of both texts are set aside first. The changed region between them is compared with a longest common subsequence (LCS) algorithm when it has at most 12,000 lines on each side and 1.5 MB in total. In each change the removed lines, marked −, are listed before the added lines, marked +, with line numbers from both versions. Unchanged runs keep three lines of context next to each change and fold the rest, and a comparison that runs longer than 15 seconds is stopped.
Processing runs in your browser
All diffing is done locally using browser APIs. Our servers are not involved at any point.
Frequently asked questions
- How is this different from side-by-side diff?
- The git-like view shows one column with added and removed lines stacked together, marked + or −, and three unchanged context lines around each change. Side-by-side puts the original on the left and the updated version on the right in two columns, which can be easier for reviewing prose, while the git-like layout is the standard for code review.
- Can it diff large files?
- Yes, within limits. Lines that match at the start and end of both texts are set aside first, so a small change in a large file is found exactly. The changed region between them is compared when it has at most 12,000 lines on each side and 1.5 MB in total. A larger changed region is marked as not compared instead of being guessed. The diff runs in a Web Worker so the page stays responsive, and a comparison that takes longer than 15 seconds is stopped.
- Does it support unified diff format?
- The view follows unified diff conventions for reading: + for added lines, − for removed lines, line numbers for both versions, and three unchanged context lines around each change. It does not produce a patch file: there are no @@ hunk headers, and the + and − markers are left out when you copy the text.
- What algorithms are used?
- The diff is computed using a line-based longest common subsequence (LCS) algorithm, the same family that powers git diff. The git-like view marks whole lines. For word-level highlighting inside changed lines, use the word diff or side-by-side view.
Related operations
For making the same change everywhere in one file, try find and replace. To put both inputs in matching order before comparing, use sort lines. For diffing two JSON payloads after pretty-printing, see the JSON formatter.
Last reviewed September 30, 2026
Other pages for this tool
Related tools
- Background reading: Complete guide to text tools