Skip to main content

Diff Checker

Compare two pieces of text and see exactly what was added, removed and left alone, by line or by character. Runs in your browser with nothing uploaded.

Paste two versions of a text and see the differences marked: additions, removals and unchanged content, with counts for each. Line mode suits code and configuration; character mode is for spotting the single edit inside a paragraph or a long value.

Diff Checker

// Diff Checker: Features

Two granularities, two purposes

Line mode compares whole lines and is the right choice for code, configuration files and anything where the line is the natural unit. It shows a changed line as one removal and one addition, which matches how version control presents a change. Character mode compares individual characters and is what you want when the difference is inside a line: a transposed digit in a long identifier, a changed word in a paragraph, or a subtly different value in a config setting.

When character mode is the answer

Two strings that look identical and behave differently are the classic case. A trailing space, a non-breaking space pasted from a web page, a Windows line ending in a file that should have Unix endings, or a Greek question mark standing in for a semicolon. Line mode simply reports the line as changed; character mode shows you exactly which character differs. It is limited to five thousand characters per side, because character comparison grows quadratically and would otherwise make the page unresponsive.

What the counts tell you

The three figures above the result report additions, removals and unchanged units. They are a quick sanity check on a comparison you are about to act on: a diff you expected to be small that reports hundreds of changes usually means the two texts have different line endings or different indentation throughout, rather than that the content really diverged. In that case, normalising whitespace first makes the real differences visible.

Comparing structured data fairly

A textual diff compares text, which is not always the same as comparing meaning. Two JSON documents with identical content but different key order or indentation produce a large diff despite being equivalent. Formatting both with the same settings first, using the JSON Formatter, makes the comparison meaningful. The same applies to YAML, SQL and any format where presentation is flexible. For JSON specifically, the JSON Diff compares structures rather than text, so key order and indentation never appear as differences.

Comparing two confidential documents

The comparison runs as JavaScript in your browser and neither side is transmitted, stored or logged. Two versions of a configuration file, a contract, a generated report or an API response can be compared without any of it leaving your machine, which is the main reason to use a browser-based diff rather than an online service that uploads what you paste.

// Diff Checker: FAQ

What is the difference between line and character mode?

Line mode treats each line as a unit and reports whole lines as added or removed, which is how version control shows changes and is right for code and configuration. Character mode compares individual characters and shows exactly which part of a line differs, which is right for prose and for long single-line values.

Why is character mode limited to five thousand characters?

Because comparing character by character grows quadratically with the length of the input, so a large document would freeze the page. Five thousand characters per side is comfortably enough for the cases character mode is useful for, and line mode has no such limit.

Why does my diff show every line as changed?

Nearly always line endings or indentation. A file saved on Windows uses carriage return and line feed while one saved on Unix uses line feed alone, and every line differs as a result. A change from tabs to spaces does the same. Normalise both sides before comparing, or use character mode on a single line to see what is actually different.

Can I compare JSON or YAML meaningfully?

Format both sides the same way first. A textual diff has no notion of semantic equivalence, so two JSON documents with the same content but different key order or indentation will differ substantially. Once both are formatted identically, the remaining differences are real.

Does it detect moved blocks?

No. A block of text moved from one place to another appears as a removal in one location and an addition in another, because that is literally what changed. Diff tools that detect moves do so with additional heuristics; this one reports the straightforward result.

Can I compare files rather than pasted text?

Paste the contents of each file into the two boxes. For comparing files on disk as an ongoing habit, your version control system or a dedicated diff tool will serve you better; this is for the ad hoc case where you have two versions in front of you.

What do the three counts mean?

How many units were added, removed and left unchanged, where a unit is a line or a character depending on the mode. They are most useful as a sanity check: a much larger number of changes than you expected usually points at a whitespace or line-ending difference rather than a real one.

Is it safe to compare confidential documents?

Yes. Both texts stay in your browser and are never transmitted, stored or logged. This is the main practical advantage over web services that process the comparison on a server, where the content passes through infrastructure you do not control.

Does it handle non-Latin text?

Yes. Comparison works on characters regardless of script, so Japanese, Chinese, Korean, Cyrillic and emoji are all handled. Be aware that some characters can be represented more than one way in Unicode, so visually identical text can legitimately differ at the character level.

Are the two texts sent to a server?

No. The comparison runs entirely in the page, and closing the tab discards both texts.

// How to Use Diff Checker

  1. Paste both versions

    Put the original into the left box and the changed version into the right. Either can be a few lines or a whole file.

  2. Choose the granularity

    Use line mode for code and configuration, where the line is the natural unit. Switch to character mode when you know the difference is inside a line and you need to see exactly which character it is.

  3. Read the result and the counts

    Additions and removals are marked in the result. If the counts are much larger than you expected, suspect line endings or indentation rather than a genuine difference, and normalise both sides before comparing again.

Category Code