TextSorter
Original
0 lines
Modified
0 lines
Mode:
Original 0 lines
Modified 0 lines

Paste text in both panels and click Compare — or just start typing

Deleted (original) Added (modified) Unchanged

What is Text Diff?

A text diff tool compares two pieces of text and shows you exactly what changed — which lines or words were added, removed, or left untouched. The concept originates from the Unix diff utility and the Myers diff algorithm, now used by virtually every version control system in the world.

Common use cases include comparing two versions of a document, reviewing code changes before a commit, spotting differences between copied and pasted content, verifying edits made by a collaborator, and reconciling config files or SQL scripts.

How the algorithm works

This tool uses an LCS (Longest Common Subsequence) algorithm to find the longest sequence of lines (or words, in word-diff mode) that appear in both texts in the same order. Everything outside the LCS is classified as a deletion from the original or an insertion in the modified version. The result is rendered as a colour-coded side-by-side view with line numbers.

How to Use the Text Diff Tool

  1. Paste your original text into the left panel labelled "Original".
  2. Paste the modified version into the right panel labelled "Modified".
  3. Click "Compare" (or just type — the diff updates automatically after a short pause).
  4. Read the colour-coded side-by-side output: red highlights show deleted lines on the left, green highlights show added lines on the right, and unchanged lines appear in both columns.
  5. Switch to Word diff mode to see individual word-level changes within each modified line.

Frequently Asked Questions

What does "diff" mean in text comparison?
The term "diff" comes from the Unix diff command, which compares files line by line. A diff shows exactly what changed between two versions — which lines were added, removed, or stayed the same. It is the foundation of version control systems like Git.
How do I compare two text files online?
Paste the content of your first file into the "Original" panel and the second file into the "Modified" panel, then click Compare. The side-by-side view highlights red for deletions (original) and green for additions (modified).
What is the difference between line diff and word diff?
Line diff highlights entire lines that were added or removed. Word diff goes deeper — for changed lines it shows which individual words were inserted or deleted within that line, making it ideal for spotting small edits in otherwise similar lines.
Can I compare source code with this tool?
Yes. The diff tool works with any plain text, including JavaScript, Python, HTML, CSS, SQL, JSON, and more. The monospace font and line numbers make code diffs easy to read. Your code never leaves your browser.

Related Tools

100% Private & Secure

All diff processing runs locally in your browser. Your text is never uploaded to any server, making this tool safe for confidential documents, proprietary source code, or any sensitive content.