Text Compare
Compare two texts or files side by side, like a code editor diff. See removed and added lines lined up, with the changed words marked.
Original
Modified
Readme
What is a side-by-side text comparison?
A side-by-side comparison puts two versions of a text in two columns and lines up the lines that match. The lines that only the first version has are marked on the left, the lines that only the second version has are marked on the right, and the unchanged lines between them stay level. It's the view code editors and code review sites use for diffs, and it makes it easy to read a change in context instead of as a list of edits.
Tool description
This tool compares two texts or files side by side. Paste the original version on the left and the modified version on the right, or open a file on each side. Removed lines turn red, added lines turn green, and inside a changed line the words that changed get a darker color. Both sides stay editable, so the comparison updates as you type.
Features
- Two editable sides, each with Paste and Upload tabs for text or plain text files
- Removed lines in red, added lines in green, and the changed words marked inside edited lines
- Striped filler rows that keep matching lines level on both sides
- Synchronized scrolling between the two sides
- Counts of removed and added lines under each side
- Paste from the clipboard, copy, and download for each side, keeping the opened file's name
- Line endings are ignored, so Windows and Mac copies of the same file compare as equal
How it works
The tool splits both texts into lines and matches the lines they have in common, using the jsdiff library. The lines left without a match are removed or added. When a removed line sits next to an added line, the two are compared word by word, and the changed words are marked if enough of the line stayed the same. When most of a line is new, the whole line is colored instead. Spaces and letter case count as changes. Everything runs in your browser, and the texts are never uploaded.
Tips
- An extra space at the end of a line marks the line as changed. If a line looks the same on both sides, look for trailing spaces.
- Long lines don't wrap. Scroll sideways to see the end of a line.
- You can open a file on one side and paste text on the other.