Stax
Tools

Diff Checker

Compare two texts line by line and see exactly what changed.

+4 added3 removed4 unchanged
ORIGINAL
MODIFIED
DIFF RESULT
- function greet(name) {
- console.log("Hello, " + name);
- return name;
+ function greet(name, greeting = "Hello") {
+ console.log(greeting + ", " + name + "!");
}
const user = "Alice";
+ const admin = "Bob";
greet(user);
+ greet(admin, "Hi");

Text diff — what changed?

Knowing exactly what changed between two versions of a document or code file is one of the most common tasks in software development and content work. A diff tool shows you the minimal set of changes needed to go from the original to the modified version.

Common uses

  • Code review — check what changed in a file before committing
  • Config files — spot differences between production and staging configs
  • Legal/contracts — compare two versions of an agreement
  • Content editing — track what an editor changed in your draft
  • Debugging — compare a working vs broken version of a config or snippet

How LCS diff works

The Longest Common Subsequence algorithm finds the largest set of lines that appear in both texts in the same order (but not necessarily contiguous). Lines in this common set are "unchanged". Everything else is either added (exists only in modified) or removed (exists only in original). This is the same fundamental algorithm used by git, diff, and most version control systems.

Who uses an online diff checker

Developers without a local IDE available (browsing from a phone, on a client machine) paste two code snippets to spot differences quickly. Writers compare two drafts of an article or email to review what their editor changed. Legal teams compare contract revisions clause by clause without installing special software. DevOps engineers paste nginx or JSON config files from two environments to identify the source of a discrepancy. Support teams compare customer-submitted log snippets against expected output to diagnose issues.

Diff checker vs git diff — when to use each

This tool is best for quick ad-hoc comparisons of text snippets, config files, or short code blocks where you don't need version history or file tracking. For ongoing code development, git diff is the right choice — it integrates with version control, supports staged vs unstaged comparisons, and can diff entire file trees. Use this checker when you have two pieces of text and just need to see what changed, without any setup.

Tips for best results

Trailing spaces and blank lines can cause misleading diffs — a line that looks identical may show as changed because of an invisible trailing space. If you are comparing code, strip trailing whitespace in your editor before pasting. For large files above 300 lines, the LCS algorithm degrades to a simpler full-swap view; split the file into sections and compare each separately for a detailed diff.

Frequently asked questions

How does the diff checker work?
The tool uses the Longest Common Subsequence (LCS) algorithm to find lines that appear in both texts. Lines only in the original are shown in red (removed), lines only in the modified are shown in green (added), and common lines are shown without highlighting.
What can I use this for?
Comparing versions of code, configuration files, documents, or any text. It's useful for reviewing changes before committing to version control, comparing contract revisions, checking what changed between two versions of a file, or spotting differences in two similar text blocks.
Is there a character or line limit?
The LCS algorithm is limited to 300 lines per side for performance. For texts longer than this, a simplified fallback is used showing all original lines and all modified lines . For large file diffs, use a dedicated version control tool like git diff.
Does the diff work on word level or line level?
This tool performs line-by-line comparison. Each entire line is compared unit. This is the standard approach for code and document diffs — the same method used by git diff by default.
Is my text sent to a server?
No. All comparison happens entirely in your browser. No data is transmitted or stored.

Related tools