Development tool
Text Diff
Compare two text blocks with an inline line-by-line diff. Text stays in your browser.
Result
Your result will appear here.
Green lines are Added; red lines are Removed. A removed/added pair represents changed text.
How to use Text Diff
- Paste the original and changed text.
- Select Compare to see added and removed lines.
Example
Before: add a line
After: edit a lineCommon use cases
- Comparing two versions of a configuration file before a deployment to see exactly which lines changed.
- Reviewing a prose edit, such as a changed paragraph in documentation or a clause in a policy, line by line.
- Checking what changed between two copies of a generated output, such as an SQL dump or a JSON export.
Input and output examples
| Input | Output | Notes |
|---|---|---|
Original: a / b / c
Changed: a / B / c | a
- b
+ B
c | One letter per line in each box. Notation used here: a minus marks a removed line, a plus marks an added line, and two spaces mark an unchanged line. |
Original: one / two
Changed: one / two / three | one
two
+ three | The line three is added at the end. |
Common mistakes to avoid
- Line endings matter. Text with CRLF line breaks compared with LF text marks every line as changed, because the carriage return stays at the end of each line.
- Whitespace is significant. Indentation changes, trailing spaces, and capital letters all appear as changes.
- A line diff has no notion of a moved block. Reordering the same lines shows up as removals and additions, not as a move.
Technical details
Lines are compared with a longest common subsequence (LCS) table built by dynamic programming. Each line is kept, removed, or added. The comparison is exact and case-sensitive, and it does not ignore whitespace. When the number of line pairs exceeds one million, the tool switches to a faster comparison that trims only the unchanged start and end, which can mark more lines as changed.
Frequently asked questions
Is my text uploaded?
No. The diff is calculated in your browser, and the tool code does not send the text to a server.
Does it ignore whitespace or case?
No. A trailing space or a capital letter counts as a change.
Why is a changed line shown as removed and added?
A line diff compares whole lines. An edited line appears as the old line removed and the new line added. The tool does not highlight the changed characters inside the line.
Why does every line look changed?
Check the line endings. Windows files end lines with CRLF, and the tool splits on the LF character only, so a stray carriage return makes each line differ from the same line in an LF file.
Can I compare two files?
The tool compares pasted text. Paste the content of each file into the two boxes.
Why does a very large comparison show a broader change?
The full comparison builds a table with one cell per pair of lines. For very large inputs the tool uses a shortcut that trims only the unchanged start and end, so changes in the middle are shown as one block.