Skip to main content
ilovecalcs logoilovecalcs.

Dev Tools · Real-time

Diff Checker & Text Compare

Paste two versions of any text, code, or config file and instantly see every addition, deletion, and unchanged section highlighted in a side-by-side or inline view. Compare by line, word, or character. All processing runs locally -- nothing is uploaded.

Original

Modified

How text diffing works

Understanding the diff algorithm and how to read the output

A diff (short for difference) is a structured representation of changes between two versions of a text. Diff tools are a cornerstone of software development, used in version control systems, code review platforms, documentation pipelines, and configuration management. This tool uses the Myers diff algorithm -- the same algorithm powering Git -- to compute the minimum edit distance between two texts.

Diff modes: lines, words, and characters

The mode controls what unit the algorithm treats as an atomic token:

  • Lines (default): Splits each input by newline characters and compares line by line. This is the mode used bygit diff and is ideal for source code, JSON or YAML configs, CSV data, and any file where lines are the logical unit. The split view shows both versions side-by-side with line numbers.
  • Words: Tokenises by whitespace and compares individual words. Useful for prose documents, changelogs, or documentation drafts where you want to see exactly which words were rewritten rather than flagging an entire line as changed.
  • Characters: Compares character by character. Best for catching typos, invisible whitespace, or single-character punctuation changes that word mode would miss. Displayed inline only, since character-level split panels are not legible.

Split view vs. inline view

  • Split view: The original text appears on the left and the modified text on the right. Removed lines are highlighted red on the left; added lines are highlighted green on the right. Unchanged lines appear on both sides without highlighting. This layout makes it easy to read context on both sides simultaneously and is the standard format for code review tools like GitHub and GitLab.
  • Inline view: A single stream showing all content in order, with a green + prefix for additions and a red - prefix for removals. This is equivalent to running git diff in a terminal. It uses less horizontal space and works better on narrow screens or for very long files.

Reading the colour coding

The colour convention follows the universal standard used by all version control systems:

  • Red (--): Content present in the original that was deleted or replaced in the modified version.
  • Green (+): Content added in the modified version that does not exist in the original.
  • Unchanged: Lines or tokens that are identical in both inputs. Displayed in neutral colour for context.

The stats strip above the diff output shows the total count of added, removed, and unchanged units at the selected granularity.

Common use cases

  • Code review: Compare two versions of a function or module to identify what changed between commits without a full Git checkout.
  • Configuration files: Spot differences between staging and production JSON, YAML, or TOML configs.
  • Document editing: Compare two drafts of a document in word mode to find exactly which phrases were rewritten.
  • API responses: Paste two JSON payloads side by side to verify that a backend change produced the expected structural differences.
  • Database schemas: Compare schema exports or migration scripts before and after a change.

The Myers diff algorithm

Published by Eugene W. Myers in 1986, the Myers algorithm finds the shortest edit script: the minimum number of insertions and deletions that transforms one sequence into another. This is equivalent to finding the longest common subsequence (LCS). The algorithm runs in O((N + M) x D) time where N and M are the input lengths and D is the size of the diff. When inputs are mostly identical (small D), the algorithm is extremely fast.

Privacy

All diffing runs entirely in your browser using the open-sourcediff JavaScript library. Your text is never sent to any server and never stored outside your current browser session.