Compare text
Compare two texts line by line with line numbers, and download a unified diff and a JSON report.
Process locally
Files stay in this browser session. Closing or clearing releases them.
Add text
Type or paste the text to process
Adjust settings
Optional: Ignore spaces at line ends, Ignore case, Context lines
Run
Processes in this browser; cancel at any time
About this tool
Compare two versions of a text line by line to see what was added, removed or left unchanged, for example two drafts of a contract, two configuration files, or a program’s output before and after a change. Each changed line is listed with its line number.
You get a unified diff (diff.txt) and a JSON report (diff.json) with counts of added, removed and unchanged lines. Each text may have up to 20,000 lines of at most 5,000 characters, and the two together up to 2 MB. Both stay in your browser and are not uploaded.
How to use it
- Paste the earlier version into “Original text” and the newer one into “Changed text”, or select Use example.
- If needed, turn on “Ignore spaces at line ends” or “Ignore case”, and set “Context lines” (0 to 10, 3 by default).
- Select Run.
- Preview diff.json and diff.txt, then download either file, or both as a ZIP.
Formats and limits
- Input
- Text
- Output
- JSON, Plain text
- Size limit
- 2 MB
- Settings
- Ignore spaces at line ends; Ignore case; Context lines
- Privacy
- Files stay in the current browser session. No file bytes are uploaded.
- Price
- Free, no sign-up
Common questions
Does it show which word changed within a line?
No. Lines are compared as a whole, so a line with any change appears as one removed line and one added line.
What does “Ignore spaces at line ends” ignore?
Spaces and tabs at the start and end of each line, so changed indentation or trailing spaces no longer count as differences. Spaces inside a line are still compared.
How do I read diff.txt?
It uses the unified diff format: lines starting with - were removed from the original, lines starting with + were added, and lines starting with a space are unchanged context. Each “@@ -a,b +c,d @@” header gives the first line and the number of lines in the original and changed text, and “Context lines” sets how many unchanged lines surround each change.
What if the two texts are identical?
diff.txt is empty, and diff.json shows identical as true with no hunks.
Why is a large block shown as all removed and then all added?
When more than about 2,000 added and removed lines in total separate the texts, the tool stops searching for the smallest set of changes to keep memory use bounded. Everything between the matching start and end of the two texts is then reported as removed and added.
Related tools
Text beautifier
Add a space between Chinese and English or numbers, optionally switch to Chinese punctuation and tidy paragraphs and spaces.
Letter case and naming styles
Change letter case line by line, or turn phrases and identifiers into camelCase, PascalCase, snake_case, kebab-case or CONSTANT_CASE.
Line tools: trim, dedupe, sort
In one pass: trim lines, remove empty or duplicate lines, count repeats, filter by length, sort (including natural and pinyin order) and add a prefix or suffix.
Chinese to pinyin
Convert Chinese to pinyin with tone marks, tone numbers or no tones, reading polyphonic characters from context; or give first letters or characters annotated with pinyin.
Punctuation converter
Turn all punctuation into Chinese full-width or English half-width marks; numbers, times and links keep theirs.
Regex find and replace
Replace or extract text with a JavaScript regular expression. Runs in an isolated worker with a hard time limit.