Diff Checker for Line-by-Line Text Comparison – Free

Paste two versions of a text and this diff checker shows which lines were removed, added or left unchanged. The comparison runs in your browser, so config files and code stay on your machine.

How to use the Diff checker tool

  1. Paste the earlier version of the text into the Original box.
  2. Paste the newer version into the Updated box, or select Example to fill both boxes with a three-line sample.
  3. Select Compare to compute the difference.
  4. Read the Result box: lines starting with - exist only in Original, lines starting with + exist only in Updated, and lines indented by two spaces are common to both.
  5. Select Copy to paste the diff into a review comment or ticket.

How an LCS-based diff checker works

The tool splits both inputs into lines and finds their longest common subsequence: the largest set of lines that appear in both texts in the same order, not necessarily next to each other. Those lines are the unchanged skeleton. Every Original line outside it is a deletion, and every Updated line outside it is an insertion.

The subsequence is computed with the classic dynamic programming table, one cell per pair of lines, filled from the end of both texts toward the start. The output is then produced by walking the table from the top. Where lines were replaced, the removed lines are printed before the added ones.

A worked example with two config files

Here Original has four settings. Updated changes the port, drops debug and adds retries. The host and timeout lines are in the common subsequence, so they anchor the result.

Original       Updated
host=db        host=db
port=5432      port=6432
debug=true     timeout=30
timeout=30     retries=3

Result:
  host=db
- port=5432
- debug=true
+ port=6432
  timeout=30
+ retries=3

What counts as a difference

Lines are compared as exact strings. Keep these rules in mind when a result looks surprising.

  • Whitespace matters. A trailing space, or a tab where the other text has spaces, makes two lines different.
  • Case matters. Timeout and timeout do not match.
  • Line endings do not matter. Both LF and CRLF are accepted as separators, so a text that only changed its line endings shows no changes.
  • A change inside a line is shown as the whole old line removed and the whole new line added. Characters within the line are not highlighted.
  • A moved line appears twice: once as a removal at its old position and once as an addition at its new one.
  • A final line break creates one extra empty line. If only one text ends with a newline, the result ends with a lone - or + marker.

Limits and output format

Each input may have up to 1,500 lines. Beyond that the tool returns Use up to 1,500 lines per input, because the table grows with the product of the two line counts. For larger files, compare the relevant sections separately.

The result lists every line of both texts, changed or not. It has no file headers, no @@ hunk markers and no line numbers, so it reads like a unified diff but cannot be applied with patch or git apply. Use your version control system when you need a patch file.

Frequently asked questions

How do I compare two text files online?

Open each file, paste the old content into Original and the new content into Updated, then select Compare. Removed lines are prefixed with a minus sign and added lines with a plus sign.

Are my texts uploaded for comparison?

No. The diff is calculated by JavaScript in the page. Neither text is sent to a server, so you can compare configuration files, contracts and source code that you are not allowed to share.

Does the diff ignore whitespace or case?

No. Comparison is exact apart from the line-ending style. If you want to ignore indentation or capitalization, normalize both texts first, for example by trimming lines or lowercasing them in your editor.

Why does a moved block show as deleted and added?

A longest common subsequence keeps lines in their original order. A block that moved cannot be in the common part at both positions, so it is reported as removed from one place and inserted at the other.

Can it compare JSON or code?

Yes, as plain text. For JSON, format both documents with the same indentation first, so layout differences do not drown out the real changes. Key order is still compared as written.

Related tools