What this tool does
Compare two blocks of text line by line and list every line added, removed or kept. You fill in these fields: Original text and Changed text. Some fields are optional. It shows lines the same, lines added, lines removed, and lines unchanged, plus a table (line by line).
Inputs
- Original text: Longer text, up to 20000 characters. Optional.
- Changed text: Longer text, up to 20000 characters. Optional.
How to use
- Type the original text. This one is optional.
- Type the changed text. This one is optional.
- Read the result: lines the same, lines added, lines removed, and lines unchanged, plus a table (line by line). It appears once every required field has a valid value.
Worked examples
Example 1. Inputs:
- Original text: "a b c"
- Changed text: "a B c d"
Results:
- Lines the same: 57.1% (of all lines in both texts are shared)
- Lines added: 2
- Lines removed: 1
- Lines unchanged: 2
- Line by line, row 1 of 5: Change unchanged; Line a; Original line no. 1; Changed line no. 1
- Line by line, row 2 of 5: Change removed; Line b; Original line no. 2; Changed line no. 0
- Line by line, row 3 of 5: Change added; Line B; Original line no. 0; Changed line no. 2
How this is worked out: Lines a, b, c versus a, B, c, d. The longest common run of lines is a, c (2 lines). Removed: b (3 - 2 = 1). Added: B and d (4 - 2 = 2). Shared share = 2 x 2 / (3 + 4) = 4 / 7 = 57.14%. Row order worked by the reviewer: a kept (line 1 on both sides), b removed (original line 2), B added (changed line 2), c kept (line 3 on both sides), d added (changed line 4); in a replaced block the removed line is listed before the added one.
Example 2. Inputs:
- Original text: "a b"
- Changed text: "b a"
Results:
- Lines the same: 50.0% (of all lines in both texts are shared)
- Lines added: 1
- Lines removed: 1
- Lines unchanged: 1
- Line by line, row 1 of 3: Change removed; Line a; Original line no. 1; Changed line no. 0
- Line by line, row 2 of 3: Change unchanged; Line b; Original line no. 2; Changed line no. 1
- Line by line, row 3 of 3: Change added; Line a; Original line no. 0; Changed line no. 2
How this is worked out: Reviewer vector. Two lines swapped. A common run must keep its order, so only one of the two lines can be matched (the longest common run has 1 line). The other is removed in one place and added in another: 1 unchanged, 1 removed, 1 added. 2 x 1 / (2 + 2) = 50%.
Example 3. Inputs:
- Original text: "x y"
Results:
- Lines the same: 0.0% (of all lines in both texts are shared)
- Lines added: 0
- Lines removed: 3
- Lines unchanged: 0
- Line by line, row 1 of 3: Change removed; Line x; Original line no. 1; Changed line no. 0
- Line by line, row 2 of 3: Change removed; Original line no. 2; Changed line no. 0
- Line by line, row 3 of 3: Change removed; Line y; Original line no. 3; Changed line no. 0
How this is worked out: Reviewer vector. The original has 3 lines: x, a blank line, y (a blank line in the middle counts). The changed text is empty, so all 3 are removed. 2 x 0 / (3 + 0) = 0%.
Example 4. Inputs:
- Changed text: "one two"
Results:
- Lines the same: 0.0% (of all lines in both texts are shared)
- Lines added: 2
- Lines removed: 0
- Lines unchanged: 0
- Line by line, row 1 of 2: Change added; Line one; Original line no. 0; Changed line no. 1
- Line by line, row 2 of 2: Change added; Line two; Original line no. 0; Changed line no. 2
How this is worked out: An empty original has 0 lines; the changed text has 2 lines, none shared. Added 2, removed 0, 2 x 0 / (0 + 2) = 0%.
Limitations
- Compares whole lines only; it does not mark which words inside a changed line differ.
- Very large texts that differ in a great many lines are refused with a message.
- Case and spacing count as differences, and so does the same accented letter stored in two different ways.
- Blank lines count as lines, except that one line break at the very end of a text is ignored.
- In the table, a line number of 0 means the line does not exist on that side.
FAQs
- Q: Does it compare words or lines?
- A: Whole lines. A line that differs by even one character counts as one line removed and one line added.
- Q: What happens to a line that moved?
- A: It is matched when it keeps its order relative to the other shared lines. Lines that swapped order are reported as removed in one place and added in another.
- Q: Does a final line break count as a line?
- A: No. A single line break at the very end of a text is ignored, so a text with and without it compares as the same.
- Q: Is the comparison case and space sensitive?
- A: Yes. Capital letters, extra spaces and tabs all make two lines different. Windows and Unix line breaks are treated as the same.
- Q: How is the percentage worked out?
- A: It is twice the number of unchanged lines, divided by the lines in the original plus the lines in the changed text. Two texts of 3 and 4 lines that share 2 lines score 4 out of 7, or 57.1%.
Explore Similar Tools
Explore more tools like this one:
- Text Cleaner - Fix messy text with one cleanup at a time: extra spaces,...
- Text to Markdown - Turn plain text into Markdown: bullet and numbered lists...
- Plain Text Editor - Simple, lightweight editor for quick drafting and...
- Format Text as Form - Turn lines of text like 'Name: Ada' or 'Colour - blue'...
- Text Tone Temperature - Analyze your writing's emotional warmth on a...