Text Diff Checker
Differences between the two texts
How to compare two texts
Paste the original text on the left and the modified text on the right. The result lists every line with its line numbers on both sides: lines starting with − were removed, lines starting with + were added, and the header shows the added and removed counts and the similarity percentage.
Pick Line, Word or Char granularity depending on what changed, and use Options to ignore whitespace, line endings, case or lines that match a regular expression. Swap exchanges the two sides; Copy diff copies the result with +/− prefixes.
Compare two versions step by step
- Paste the original on the left and the changed version on the right, or use Upload on either pane to load a text file of up to 5 MB.
- Choose Line, Word or Char under Compare by.
- Open Options when the two versions differ only in formatting: whitespace, line endings, tabs or letter case.
- Read the result. Lines marked − exist only in the original, and lines marked + exist only in the modified text.
- Copy the diff, or export it as a Git patch, a Markdown table or HTML. Try an example loads a code review, a contract revision or a .env change if you want to see the output first.
Diff examples
- Config change. The original has PORT=3000, DEBUG=true and DB_HOST=localhost; the modified file changes the port to 8080 and adds CACHE_TTL=60. At Line granularity the result shows −PORT=3000 and +PORT=8080 as one changed line and +CACHE_TTL=60 as an added line. The two untouched lines stay as context.
- Contract wording. Compare "The fee is 500 dollars per month." with "The fee is 550 dollars per quarter." At Word granularity only 500 → 550 and month → quarter are marked. At Line granularity the whole sentence is one changed line.
- Windows and Unix line endings. A file saved with CRLF compared with the same file saved with LF shows every line as changed. Turn on Ignore line endings and the two texts are reported as identical.
- Dates that always change. Add \b\d{4}-\d{2}-\d{2}\b under Ignore patterns and any date such as 2026-01-15 counts as equal on both sides, so two daily exports differ only where their data differs.
How to read a unified diff
The exported patch starts with --- a/original and +++ b/modified. Each hunk opens with a header such as @@ -1,4 +1,5 @@, which means the hunk covers 4 lines starting at line 1 of the original and 5 lines starting at line 1 of the modified text. Lines that begin with a space are unchanged context, − lines were removed and + lines were added. A changed line appears as a − line followed by a + line.
Common mistakes when comparing text
- Comparing reformatted code as it is. After a formatter changes the indentation, almost every line differs. Turn on Ignore leading whitespace or Ignore all whitespace to see only the real edits.
- Pasting the two versions in the wrong order. Additions then show as removals. Click Swap rather than pasting again.
- Using Char granularity on a long document. Above 5,000 characters per side the comparison falls back to Word and the page says so. Compare one paragraph at a time when you need character-level detail.
- Exporting a patch from a Word or Char comparison. A unified diff is line-based, so switch to Line before you copy or download the patch.
- Sharing a link that contains secrets. Share via URL puts both texts in the link itself, so they end up wherever the link goes, including chat logs and browser history.
- Uploading a Word document or PDF. Upload accepts text files only. Copy the text out of the document first; formatting such as bold or a font change is not compared.
Diff checker FAQ
Are my comparisons saved or shared?
The last 5 comparisons are kept in this browser's localStorage, where you can clear them. If you turn on Share via URL, both texts are encoded into the part of the URL after #, so anyone you send the link to can read them.
How does the diff checker find the differences?
It uses the Myers diff algorithm (Eugene W. Myers, 1986), which is also Git's default. It finds the shortest edit script: the fewest deletions and insertions that turn the original into the modified text. Runs of deletions followed by insertions are paired up and shown as changed lines. The percentage next to the +/− counts is the share of unchanged lines, where a changed line counts once on each side.
Should I compare by line, word or character?
Use Line for code, config files and logs; it matches what git diff shows. Use Word for contracts and prose, where one edited word should not mark the whole sentence as changed. Words are runs of letters, digits and underscores; spaces and punctuation are separate tokens. Use Char to find single-character edits such as typos or a changed digit in an ID.
How do I ignore whitespace, case or timestamps in a diff?
Open Options. You can ignore all whitespace, only leading or trailing whitespace, CRLF vs LF line endings, tabs vs spaces (a tab counts as 4 spaces) and letter case. For values that always change, add a JavaScript regular expression per line under Ignore patterns: at line granularity, ^Last updated:.*$ treats every line starting with "Last updated:" as equal on both sides.
Can I compare two files?
Yes, text files. Upload loads a file of up to 5 MB into either side, including .txt, .md, .csv, .json, .yaml, .xml, .html, .log and .env files and source code such as .js, .ts, .py, .java, .go or .sql. Word documents, PDFs and images are not supported; copy their text and paste it instead.
How large can the texts be?
There is no fixed line limit; very large inputs take longer because the work grows with the number of differences. Character granularity switches to word granularity when a side is longer than 5,000 characters, and the page shows a notice when that happens. Share via URL stops updating the link once the encoded texts exceed 8,000 characters.
Can I export the diff as a patch file?
Yes. Copy as Git patch or Download .patch produces a unified diff with --- a/original and +++ b/modified headers, @@ hunk headers and 3 lines of context. Export at line granularity, since word and character diffs do not map to patch lines. Before applying it to a file, run git apply --check to confirm it applies cleanly. You can also copy the diff as a Markdown table or as HTML.
Related tools
Related articles
- Six Edge Cases Most CSV-to-JSON Converters Get Wrong
From RFC 4180 quote escapes to type inference corrupting IDs, here are the CSV ↔ JSON conversion pitfalls you only notice once they hit production.