logo Toolmaxy
New

Code & Text Diff Checker

Compare two code or text files side-by-side. Highlights added, removed, and modified lines in real time. Supports unified view, syntax highlighting, and export.

Original
Modified

About This Tool

The Code & Text Diff Checker is a free, browser-based tool that compares two versions of any text or code and highlights exactly what changed. It uses a Myers diff algorithm - the same algorithm used by Git - to compute the minimal set of additions and deletions needed to transform the original text into the modified version. All processing happens locally in your browser; your code is never sent to any server.

The tool supports inline character-level diffing for modified lines, so you can see not just which lines changed but exactly which characters within those lines are different. It also supports collapsing unchanged sections to keep the view focused on what matters, and provides export options including standard .patch files compatible with the Unix patch command and Git.

Use the ignore whitespace option to skip over formatting-only changes like re-indentation, and ignore case to treat uppercase and lowercase letters as identical. The language selector labels the diff with the appropriate language name for context - useful when exporting or sharing diffs with teammates.

Side-by-Side vs Unified View

Side-by-side view displays the original and modified text in two columns. Deleted lines appear on the left in red, added lines appear on the right in green, and unchanged lines appear in both columns. This layout makes it easy to compare corresponding sections and understand the context of each change.

Unified view shows both versions in a single column, with removed lines prefixed by - and added lines prefixed by +. This is the same format produced by git diff and is the standard format for patch files. It uses less horizontal space and is better suited for narrow screens or long lines.

How to Use

  1. Paste your original text or code into the left (Original) editor.
  2. Paste the modified version into the right (Modified) editor.
  3. Click the "Compare" button to run the diff. The result appears above the editors.
  4. Use the view mode buttons to switch between Side-by-Side and Unified views.
  5. Enable "Ignore whitespace" to skip indentation-only changes, or "Ignore case" for case-insensitive comparison.
  6. Use "Copy Changes" to copy only the diff lines, or "Export .patch" to download a standard patch file.

Frequently Asked Questions

What is a diff checker?

A diff checker compares two versions of text or code and highlights the differences between them. Added lines are shown in green, removed lines in red, and modified parts within a line are highlighted inline. It's an essential tool for code review, debugging, and tracking changes.

What is the difference between side-by-side and unified view?

Side-by-side view shows the original and modified text in two columns, making it easy to compare corresponding lines. Unified view shows both versions in a single column, with added lines marked with "+" and removed lines with "-" - similar to the output of the "git diff" command.

What does "ignore whitespace" do?

When enabled, the diff ignores differences that consist only of whitespace changes (spaces, tabs, indentation). This is useful when comparing code that has been reformatted or re-indented without any logical changes.

What is a .patch file?

A .patch file is a standard format for representing differences between two files. It uses the unified diff format (the same format as "git diff") and can be applied to a file using the "patch" command to reproduce the changes. Patch files are widely used in open-source development for sharing code changes.

Is my code sent to a server?

No. All diff computation happens entirely in your browser using JavaScript. Your code never leaves your device.

What languages does syntax highlighting support?

The diff checker supports syntax highlighting for JavaScript, TypeScript, JSON, HTML, CSS, Python, SQL, Markdown, and plain text. Select the language from the dropdown to enable highlighting.