Text Diff Viewer

Compare two texts or files line by line: added, removed and changed lines shown side by side or as a unified diff, with word-level highlights.

Your inputs and files stay in your browser

Paste the original text or open a file.

Paste the changed text or open a file.

View mode
Output

Fill in both sides and press Compare to see the differences here.

On this page

Paste two versions of a config file, code snippet or document and see exactly which lines were added, removed or changed — in a side-by-side or line-by-line (unified) view similar to a Git diff.

Detailed Functionality

The comparison is line-based: jsdiff builds a unified patch and diff2html renders it with line numbers, up to 4 unchanged context lines around each change and word-level highlighting inside modified lines. Only the changed regions (hunks) are shown, not the whole text. Whitespace and letter case are significant, so a changed indentation or trailing space counts as a change.

Each side can be typed, pasted or loaded from a local text file (read as UTF-8). Line endings are normalized, so a Windows (CRLF) file and a Unix (LF) file with the same lines are reported as identical. When both sides are loaded from files, the comparison starts automatically; identical inputs report that there are no differences.

The diff is computed in your browser and files are read locally — nothing is uploaded. To keep the page responsive, very different texts are capped: if more than 1,000 lines differ, the tool shows a message instead of a diff.

Practical Examples

Config change: original lines host=localhost, port=8080, debug=true against host=0.0.0.0, port=8080, debug=false — the host and debug lines are marked as removed and added with the changed words highlighted, while port=8080 stays as unchanged context.

One line in a long file: in a 20-line text where only line 11 changed, the diff shows a single hunk @@ -7,9 +7,9 @@ — the change plus 4 lines of context on each side.

Comparing two files: choose the old and the new version with the file buttons; the diff appears as soon as both are loaded.

Checking a copy: comparing two identical texts reports that no differences were found.

How to Use This Tool

  1. Add the original

    Paste text into Original Text or press Choose original file.

  2. Add the modified version

    Paste text into Modified Text or press Choose modified file.

  3. Compare

    Press Compare. When both sides come from files, the diff appears automatically.

  4. Switch the view

    Under View mode, choose Side by side or Unified; Clear resets both fields.

Tips and Best Practices

  • Side by side is easier to read on wide screens, Unified on phones.
  • Only plain text can be compared; images, PDF or Word documents are not supported.
  • If more than 1,000 lines differ, compare the files in smaller parts.
  • Reformat JSON or minified code first (one item per line) — a single long line produces a single changed line.
  • After the first visit the page also works without a network connection.