Compare text
Compare two texts line by line, with a side-by-side view of changes.
- 1Add input
- 2Adjust settings
- 3Get your result
Tool input and files are processed in this browser without being uploaded.
Before you start
Compare an original and a revised text line by line. Review aligned changes, then download the complete texts as before.txt and after.txt. These UTF-8 files contain the texts used in that comparison; ignoring whitespace changes how lines are matched, not the saved text.
How to use this tool
- Paste the original into “Original text” or select a local UTF-8 text file, then paste the changed version into “Revised text”. Clear Original text if you want to compare the selected file instead.
- Choose whether to ignore whitespace differences in Options, then select “Compare texts”.
- Review the aligned line numbers and changes. Use “Download” beside before.txt or after.txt to keep the complete text from that run, without diff markers or line numbers.
Supported inputs and limits
Each pasted text can contain up to 1 MiB of UTF-8 text. You may select one file up to 10 MiB for the original; filenames are limited to 512 UTF-16 code units. Some characters, including emoji, use two code units.
Each side can contain at most 4,000 lines, counting a final empty line after a line ending. The comparison also requires (original lines + 1) × (revised lines + 1) to be no greater than 4,000,000. Reduce the number of lines if this limit is reached.
Worked example
Example input
a b a c
Example options
{}Example output
{
"diff": [
{
"type": "same",
"left": "a",
"right": "a",
"leftLine": 1,
"rightLine": 1
},
{
"type": "delete",
"left": "b",
"right": "",
"leftLine": 2,
"rightLine": null
},
{
"type": "insert",
"left": "",
"right": "c",
"leftLine": null,
"rightLine": 2
}
]
}When something does not work
Check the reported input limit or file problem. Reduce the text size or line counts, shorten a long filename, or remove a file you are not using. For a decoding error, save an external UTF-8 copy and select it again. Compare again after changing the input; cancelling a run lets you start another comparison.
Frequently asked questions
Are my files uploaded?
No. The comparison runs in your browser. The same tab may temporarily retain a recent workspace while you switch tools, subject to memory limits; it is not a backup. Refreshing or closing the tab clears it. Download any result you want to keep.
Does ignoring whitespace change the saved text?
No. For matching only, the option collapses each run of whitespace to one space and trims the start and end of each line. The result files keep both input texts unchanged, including lines considered equal under that rule. This is a line comparison, not a word-level comparison or a merge tool.
Which input becomes the original text?
Nonempty Original text takes priority over a selected file. Clear that field to use the file, which must decode as UTF-8. A selected file is still checked and read even when pasted text takes priority, so remove an inaccessible or oversized file before trying again. Both texts may be empty. The result files contain the texts used in that run; after editing an input, compare again to update them.
Documentation & further reading
Related tools
JSON formatter and string tools
Format or minify JSON, sort object keys, or convert between plain text and a JSON string.
JavaScript regex tester
Test JavaScript patterns against text and inspect matches, positions and capture groups.
HTML formatter
Format HTML source with consistent indentation and review the result as text.
CSS formatter
Reformat CSS into readable rules with consistent indentation and spacing.