Text Diff Checker
Compare two blocks of text and highlight added, removed and unchanged lines or words.
How to use this tool
Steps for using the Text Diff Checker.
- Paste the original text on the left (or top on mobile) and the changed text into Modified text. Click Sample to try an example.
- Choose what to compare by: Lines (default), Words or Characters.
- Optionally tick Ignore whitespace or Ignore case to hide changes you do not care about.
- Read the differences in Side by side or Inline view — removed content is red with a
−marker, added content green with a+. Use Swap to reverse the direction. - Copy the Unified diff, or download it as
changes.patchto apply withgit applyorpatch.
Example
Unified diff of a one-line change
const port = 3000;
const host = "localhost";
start(host, port);===================================================================
--- original.txt
+++ modified.txt
@@ -1,3 +1,3 @@
-const port = 3000;
+const port = 8080;
const host = "localhost";
start(host, port);Common use cases
- Comparing two versions of a config file, such as YAML or
.env, to see exactly what changed. - Reviewing edits to a document, contract or translation word by word.
- Checking whether two log excerpts or API responses differ, ignoring whitespace.
- Creating a
.patchfile to share a change without a Git repository. - Spotting a single-character typo between two long strings with character mode.
How the text diff works
Differences are computed with the jsdiff library, which implements Eugene Myers' O(ND) algorithm — the same family of algorithm used by git diff and GNU diff. It finds the shortest sequence of insertions and deletions that turns the original into the modified text, so unchanged lines line up and only real changes are highlighted. Its cost grows with the size of the texts multiplied by the number of differences, which is why each side is limited to 200,000 characters and the comparison gives up after 3 seconds on pathological inputs.
In Lines mode, each line is compared as a whole, and the summary counts added, removed and unchanged lines. A changed line appears as a removal followed by an addition; in side-by-side view they are paired on the same row. Words mode highlights changed words within running text, which suits prose and long lines; Characters mode pinpoints single-character edits such as a typo or a changed digit.
Ignore whitespace treats lines as equal when they differ only in leading/trailing whitespace or in the amount of whitespace between words, which hides indentation and re-wrapping changes. Ignore case treats upper- and lower-case letters as equal. When a line is considered equal only because of these options, the side-by-side view still shows each side's own text.
The unified diff output follows the standard format: a header with file names, then hunks starting with @@ -start,count +start,count @@, with three lines of context, - for removed lines and + for added lines. It is always line-based and case-sensitive, and it honours Ignore whitespace only for leading and trailing whitespace. Colour is never the only cue: every changed line also has a + or − marker, and screen readers announce additions and removals.
Limitations
- Each text is limited to 200,000 characters, and very dissimilar texts may time out.
- Only the first 3,000 rows are rendered in the line views; the unified diff always contains every change.
- The patch is always case-sensitive and line-based, regardless of the selected mode.
- Structured formats are compared as text — for key-order-insensitive comparison of JSON, use JSON Diff.
Frequently asked questions
What is the difference between side-by-side and inline view?
Side-by-side shows the original and modified text in two columns with changed lines paired up; it is the default on wide screens. Inline shows a single column with removed lines above added ones, which fits better on phones.
How do I apply the downloaded patch?
Rename the file names in the header to match your files if needed, then run git apply changes.patch or patch -p0 < changes.patch in the right directory. The Git Command Helper covers related Git commands.
Why does a one-word change show the whole line as changed?
In Lines mode the unit of comparison is a line. Switch to Words or Characters to see exactly which part of the line changed.
Can I compare JSON files?
Yes, as text. If the files differ only in key order or formatting, run both through the JSON Formatter with sorted keys first, or use JSON Diff for a structural comparison.
Is my text sent to a server?
No. The comparison runs entirely in your browser.