±

Text Difference Checker

Compare two texts line by line and highlight changes

0Added lines
0Removed lines
0Unchanged lines

Text Difference Checker — what it does

Compare two versions of a text line by line and see which lines were added, which were removed and which are unchanged, with counts for each. It answers the question every revised document raises: what actually changed between these two versions?

Worked example

Two versions of a meeting invitation compared line by line: the original in the left box, the revised text in the right. Each output line carries a marker — minus for removed, plus for added, a space for unchanged — and the counters read Added 3, Removed 2, Unchanged 2.

Input — original (left box) and revised (right box)

ORIGINAL
Subject: Q4 planning meeting
Date: Monday 26 October, 10:00
Agenda: budget review, hiring plan
Please confirm attendance by Friday.

REVISED
Subject: Q4 planning meeting
Date: Tuesday 27 October, 10:00
Agenda: budget review, hiring plan, office move
Bring the updated headcount sheet.
Please confirm attendance by Friday.

Output — line diff

  Subject: Q4 planning meeting
- Date: Monday 26 October, 10:00
- Agenda: budget review, hiring plan
+ Date: Tuesday 27 October, 10:00
+ Agenda: budget review, hiring plan, office move
+ Bring the updated headcount sheet.
  Please confirm attendance by Friday.

A changed line is reported as one removal plus one addition; here both removals are listed before the three additions, and the tool does not pair them up or highlight the changed words.

When this tool helps

  • Comparing a revised document against the version you last read.
  • Checking what changed between two configuration files or scripts.
  • Verifying that an edit touched only the lines it was supposed to touch.

How to use it

  1. Paste the original text on one side.
  2. Paste the revised text on the other.
  3. Compare the two.
  4. Read the added, removed and unchanged line counts and the highlighted output.

Accuracy, limits, and good practice

  • Comparison is line-based, so a paragraph reflowed to a different width shows as entirely changed even when the words are identical.
  • Normalise whitespace with the text cleaner first if trailing spaces are producing noise in the result.
  • Moved blocks appear as a removal in one place and an addition in another; the diff cannot tell a move from a delete-and-insert.
  • Paste the older version on the left and the newer on the right consistently; a diff read in the wrong direction reverses every addition and removal.

Frequently asked questions

Why is everything marked as changed?

Usually different line breaks — one version hard-wrapped and the other not. Reflow or clean both sides before comparing.

Can it compare word by word?

This works at line level. For a fine-grained comparison, split the text into shorter lines first.

Can I diff two files rather than pasted text?

Open each file and paste its contents in. For repeated file comparison, a version control diff is the better tool.

Is there a size limit?

The comparison builds a table with one cell for every pair of lines (lines in A × lines in B), so the cost grows with the product: two 2,000-line texts need 4 million cells, two 10,000-line texts 100 million, at which point the browser tab may run out of memory or freeze. Keep each side under a few thousand lines, or compare one section at a time.

Why is there an extra empty unchanged (or added) line at the end?

Text is split on line-feed characters only, so a trailing line break produces an empty last line that is counted like any other. If only one side ends with a line break, the diff shows an extra empty added or removed line. A carriage return (Windows line ending) is kept as part of the line, so a CRLF text compared with an LF text shows every line as changed.

Related tools on this site

Everything above runs inside this page. Text Difference Checker needs no account, no upload, and no server round trip — close the tab and nothing is left behind.

文字差異比較能做什麼

逐行比較兩個版本的文字,看出哪些行新增、哪些被移除、哪些沒變,並提供各項計數。它回答了每份修訂文件都會引出的問題:這兩版之間到底改了什麼?

實際範例

同一封會議邀請的兩個版本逐行比較:原始版放左邊方框、修訂版放右邊方框。每一行前面帶有標記:減號代表拿掉、加號代表新增、空格代表未變;計數顯示新增 3、拿掉 2、未變 2。

來源:原始版(左方框)與修訂版(右方框)

ORIGINAL
Subject: Q4 planning meeting
Date: Monday 26 October, 10:00
Agenda: budget review, hiring plan
Please confirm attendance by Friday.

REVISED
Subject: Q4 planning meeting
Date: Tuesday 27 October, 10:00
Agenda: budget review, hiring plan, office move
Bring the updated headcount sheet.
Please confirm attendance by Friday.

逐行差異

  Subject: Q4 planning meeting
- Date: Monday 26 October, 10:00
- Agenda: budget review, hiring plan
+ Date: Tuesday 27 October, 10:00
+ Agenda: budget review, hiring plan, office move
+ Bring the updated headcount sheet.
  Please confirm attendance by Friday.

被改動的行會被回報成一筆拿掉加一筆新增;這裡兩筆拿掉的行排在三筆新增之前,工具不會把兩者配對,也不會標示改了哪幾個字。

什麼時候用得上

  • 把修訂後的文件與你上次讀過的版本比對。
  • 檢查兩份設定檔或腳本之間的差異。
  • 驗證這次編輯只動到該動的那幾行。

使用步驟

  1. 在一側貼上原始文字。
  2. 在另一側貼上修訂後的文字。
  3. 執行比較。
  4. 查看新增、移除與未變更的行數及標示結果。

精確度、限制與實務建議

  • 比較以行為單位,段落若重新換行成不同寬度,即使字句相同也會整段顯示為變更。
  • 若尾端空白造成雜訊,請先用文字清理工具統一空白再比較。
  • 被搬移的段落會在一處顯示為移除、另一處顯示為新增;差異比對無法分辨「搬移」與「刪除後再插入」。
  • 請固定把舊版貼左邊、新版貼右邊;方向讀反了,所有新增與刪除的意義都會顛倒。

常見問題

為什麼全部都被標成變更?

通常是換行不同——一版硬換行、另一版沒有。比較前請先讓兩邊的換行一致或清理過。

可以逐字比較嗎?

此工具以行為單位。需要更細的比較,請先把文字切成較短的行。

可以直接比對兩個檔案嗎?

請分別開啟檔案再把內容貼上。需要反覆比對檔案時,版本控制的差異工具更合適。

有大小限制嗎?

比較時會建立一張表,左右兩邊每一對行各佔一格(A 的行數 × B 的行數),成本隨乘積增長:兩份 2,000 行的文字需要 400 萬格,兩份 10,000 行則需要 1 億格,此時瀏覽器分頁可能記憶體不足或當掉。每邊請控制在幾千行以內,或分段比較。

為什麼最後多了一行空白的未變(或新增)行?

文字只依換行字元切分,所以結尾的換行會產生一個空的最後一行,和其他行一樣被計算。若只有一邊以換行結尾,差異裡就會多一行空白的新增或拿掉。回車字元(Windows 換行)會被視為該行內容的一部分,因此 CRLF 文字與 LF 文字相比時每一行都會顯示為已改動。

本站相關工具

以上步驟全部在這個頁面內完成,文字差異比較 不需要註冊、不上傳檔案、也不經過伺服器,關閉分頁後不會留下任何資料。