Skip to content

Text Diff Checker — Compare Two Texts or Code Snippets Online

Free

Compare two texts side by side with line-by-line diff highlighting. Changed, added, and removed lines clearly marked. Free, browser-based, instant.

compare two texts onlinetext comparison toolonline diff tool
All Developer Tools

Settings guide

Diff mode:

  • ·Line-by-line — Changes shown as full added/removed lines with line numbers. Best for code, configs, and structured text.
  • ·Word-by-word (inline) — Changes highlighted at the word level within each line. Better for prose, documentation, and text with small inline edits.

Display options:

  • ·Show context lines — Show N unchanged lines above and below each changed block for context. 3 lines is the Git default.
  • ·Ignore whitespace — Treats runs of whitespace as equivalent. Useful when indentation changed but content did not.
  • ·Ignore case — Case differences are not flagged as changes.

Format comparison

Text diff vs Git diff: Git diff produces unified diff format (+ and - line markers with @@ hunk headers), designed for patch files and version control. The online diff is designed for visual inspection — colour-coded, human-readable, without the patch file syntax. Use Git diff for commits; use the online diff for quick visual comparison when you do not have Git context.

Word-level vs line-level diff: Line-level diff shows which lines changed but not where in the line. Word-level diff shows the exact characters that changed within each line. For single-character changes in a long line (a changed flag, a different value), word-level is significantly more useful.

How it works

1

Tokenise

Both texts are split into lines (line mode) or words (word mode). Whitespace normalisation and case folding are applied if the corresponding options are enabled.

2

Compute shortest edit sequence

The Myers diff algorithm finds the minimum number of additions and deletions needed to transform text A into text B. This gives the most minimal, meaningful diff — not just any sequence of edits.

3

Mark changes

Lines or words are marked as: unchanged (shown in context), added (in text B but not text A — green), or removed (in text A but not text B — red).

4

Display with line numbers

Both texts are displayed side by side or in unified format with original and new line numbers. Changed blocks are grouped with unchanged context lines above and below.

About this format

Paste two versions of any text — config files, API responses, code snippets, documentation drafts — and see exactly what changed: added lines in green, removed lines in red, unchanged context in neutral. The diff uses the standard Myers algorithm, the same one used by Git, to produce the shortest edit sequence between two texts.

Common uses: comparing two API responses to spot what changed between deploys, reviewing a config file before and after an edit, diffing JSON payloads when debugging an integration, and comparing two versions of a script or document.

Frequently asked questions

What algorithm does the diff use?+
The Myers diff algorithm, the same algorithm used by Git, GNU diff, and most version control systems. It finds the shortest edit sequence between two texts — the minimum number of additions and deletions — producing the most human-readable diff.
Can I diff JSON or code files?+
Yes. For JSON, format both files with consistent indentation before pasting (use the JSON Formatter) so that whitespace differences do not create noise in the diff. For code, the line-by-line mode with syntax-appropriate context lines is most useful.
Is there a file size limit?+
The diff runs in your browser — there is no server-side limit. Texts up to a few thousand lines diff instantly. Very large texts (tens of thousands of lines) may take a second or two but will complete without any upload.
How do I ignore whitespace-only changes?+
Enable the 'Ignore whitespace' option. This is useful when re-indentation or line ending changes (CRLF vs LF) would otherwise create noise in the diff. Only non-whitespace content differences are flagged.
Can I compare two files instead of pasting text?+
Yes. Upload two files and their content is read into the two comparison panels. The diff is computed from the file content — file names and metadata are not compared.

Related tools and guides