Skip to content

Text & Code Diff Checker

Compare two texts or code snippets line by line in side-by-side or unified view and copy the unified diff. The API also diffs JSON and YAML.

Text & Code Diff Checker

View:
+9-64 unchanged

9 added, 6 removed, 4 unchanged

10 lines
13 lines
Diff result15 changes
Original
Modified
1
function greet(name) {
2
  console.log("Hello, " + name);
3
  return true;
4
}
5
6
const users = ["Alice", "Bob"];
7
8
for (let i = 0; i < users.length; i++) {
9
  greet(users[i]);
10
}
1
function greet(name, greeting = "Hello") {
2
  const message = `${greeting}, ${name}!`;
3
  console.log(message);
4
  return message;
5
}
6
7
const users = ["Alice", "Bob", "Charlie"];
8
9
for (const user of users) {
10
  greet(user);
11
}
12
13
export default greet;

Updated . Provided as is. Check the output before you rely on it in production.

How to use Text & Code Diff Checker

  1. 1

    Paste two versions of text or code

    Paste the original version in the left panel and the modified version in the right panel. Works for any text, code, or configuration files.

  2. 2

    View side-by-side diff highlighting

    Additions are highlighted green, deletions in red, changes in yellow. The viewer automatically aligns similar lines for easy comparison.

  3. 3

    Toggle between split and unified view

    Switch between side-by-side (split) and consolidated (unified) diff view. Use unified view for a more compact representation.

  4. 4

    Count statistics

    See total additions, deletions, and changed lines. Useful to estimate the scope of changes or code review effort.

  5. 5

    Copy specific sections or entire diff

    Copy the whole diff in standard unified format, compatible with git apply and other patch tools.

Questions and answers

What is Text & Code Diff Checker?
A diff shows which lines were added or removed between two versions of a text. This checker compares two inputs line by line, shows the result side by side or as a unified diff with line numbers, and copies the unified patch. Its REST API also compares JSON and YAML by key path.
Does it support syntax highlighting for code diffs?
No. It colors added and removed lines in side-by-side or unified view, but does not apply language-specific syntax colors.

REST API

Base URL

https://aidevhub.io/api/structured-diff/

No authentication, fair use. Abusive traffic is throttled at the edge; responses carry no quota headers. CORS enabled. OpenAPI spec

Endpoints

POST /api/structured-diff/ Compare two inputs

Example

curl -X POST https://aidevhub.io/api/structured-diff/ -H "Content-Type: application/json" -d '{"a": "hello world", "b": "hello earth"}'

Example Response

{
  "format": "text",
  "changes": [
    {
      "type": "modified",
      "old": "hello world",
      "new": "hello earth"
    }
  ]
}
For AI agents: how to call this tool

Machine-readable contract, endpoints and examples. Humans can ignore this section.

Best Path For Builders

Dedicated API endpoint

Deterministic outputs, machine-safe contracts, and production-ready examples.

Dedicated API

https://aidevhub.io/api/structured-diff/

OpenAPI: https://aidevhub.io/api/openapi.yaml

POST /api/structured-diff/ Compare two inputs