Skip to content
CODE FORMATTING & MINIFICATION

Code Diff Checker – Compare Text Online

Compare two text blocks and see added and removed lines.

  • Free
  • No signup
  • Runs in your browser

This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.

Code Difference Checker

About Code Difference Checker

The Code Difference Checker compares two pieces of text line by line and shows what was removed, what was added and what stayed the same. Removed lines start with a minus sign, added lines start with a plus sign and unchanged lines are indented, similar to a Git diff.

It uses a longest-common-subsequence comparison, so a single inserted line does not mark everything below it as changed. A short summary at the top counts the removed and added lines.

How to use Code Difference Checker

  1. Paste the original text, then a line containing only ---SECOND---, then the new text.
  2. Click Run Tool. The diff appears with a summary of added and removed lines.
  3. Copy the diff or download it as a text file.

Example

Input

<h1>Hello</h1>
<p>Welcome</p>
<p>Contact us</p>
---SECOND---
<h1>Hello</h1>
<p>Welcome to NHP Learning</p>
<p>Contact us</p>
<footer>2026</footer>

Output

1 line removed, 2 lines added

  <h1>Hello</h1>
- <p>Welcome</p>
+ <p>Welcome to NHP Learning</p>
  <p>Contact us</p>
+ <footer>2026</footer>

Common uses

  • Checking what changed between two versions of a configuration or template file.
  • Comparing code from two sources before merging.
  • Reviewing edits made to a document or an SQL script.

Privacy and safety

This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.

Frequently asked questions

How do I separate the two texts?

Put the line ---SECOND--- on its own line between them. Everything above it is the original and everything below it is the new version.

Does it compare words or characters inside a line?

No. The comparison is per line, so a changed word shows the whole line as removed and added.

Is there a size limit?

The browser diff works up to about 2,000 lines per side. For larger files use Git or a desktop diff tool.

Learn to build this yourself

Free tutorials and courses on NHP Learning cover PHP, JavaScript, SQL and WordPress, from the basics to real projects.