Use Text Diff Checker

Enter your data below to use the Text Diff Checker

📌 Try these examples:
RESULT

Last updated

Text Diff Checker Examples

The Text Diff Checker compares two pieces of text and highlights additions, deletions, and changes. Below are practical examples for comparing code, configuration files, JSON responses, and documents.

Basic Line-by-Line Diff

// Version A
function greet(name) {
  return "Hello, " + name;
}

// Version B
function greet(name, greeting = "Hello") {
  return `${greeting}, ${name}!`;
}

// Diff output:
- function greet(name) {
+ function greet(name, greeting = "Hello") {
-   return "Hello, " + name;
+   return `${greeting}, ${name}!`;
  }

Red lines (−) were removed. Green lines (+) were added. Unchanged lines have no prefix.

Configuration File Comparison

// nginx.conf — Before
server {
    listen 80;
    server_name example.com;
    root /var/www/html;
    index index.html;
}

// nginx.conf — After
server {
    listen 80;
    listen 443 ssl;
    server_name example.com www.example.com;
    root /var/www/html;
    index index.html index.php;
    ssl_certificate /etc/ssl/certs/example.crt;
    ssl_certificate_key /etc/ssl/private/example.key;
}

// Diff:
  server {
      listen 80;
+     listen 443 ssl;
-     server_name example.com;
+     server_name example.com www.example.com;
      root /var/www/html;
-     index index.html;
+     index index.html index.php;
+     ssl_certificate /etc/ssl/certs/example.crt;
+     ssl_certificate_key /etc/ssl/private/example.key;
  }

JSON API Response Comparison

// Expected response
{
  "id": 42,
  "name": "Alice",
  "role": "admin",
  "active": true,
  "email": "alice@example.com"
}

// Actual response
{
  "id": 42,
  "name": "Alice",
  "role": "user",
  "active": false,
  "email": "alice@example.com",
  "lastLogin": "2024-01-15T10:30:00Z"
}

// Diff:
  {
    "id": 42,
    "name": "Alice",
-   "role": "admin",
+   "role": "user",
-   "active": true,
+   "active": false,
    "email": "alice@example.com",
+   "lastLogin": "2024-01-15T10:30:00Z"
  }

Document Revision Comparison

// Draft 1
The API accepts POST requests with a JSON body.
Authentication is required for all endpoints.
Rate limiting is applied per IP address.

// Draft 2
The API accepts POST and PUT requests with a JSON body.
Authentication is required for all endpoints.
Rate limiting is applied per API key, not per IP address.
Requests exceeding the limit receive a 429 status code.

// Diff:
- The API accepts POST requests with a JSON body.
+ The API accepts POST and PUT requests with a JSON body.
  Authentication is required for all endpoints.
- Rate limiting is applied per IP address.
+ Rate limiting is applied per API key, not per IP address.
+ Requests exceeding the limit receive a 429 status code.

SQL Schema Comparison

// Schema v1
CREATE TABLE users (
    id BIGINT PRIMARY KEY,
    name VARCHAR(100),
    email VARCHAR(255) UNIQUE,
    created_at TIMESTAMP
);

// Schema v2
CREATE TABLE users (
    id BIGINT PRIMARY KEY,
    first_name VARCHAR(50),
    last_name VARCHAR(50),
    email VARCHAR(255) UNIQUE NOT NULL,
    phone VARCHAR(20),
    created_at TIMESTAMP DEFAULT NOW(),
    updated_at TIMESTAMP
);

// Diff:
  CREATE TABLE users (
      id BIGINT PRIMARY KEY,
-     name VARCHAR(100),
+     first_name VARCHAR(50),
+     last_name VARCHAR(50),
-     email VARCHAR(255) UNIQUE,
+     email VARCHAR(255) UNIQUE NOT NULL,
+     phone VARCHAR(20),
-     created_at TIMESTAMP
+     created_at TIMESTAMP DEFAULT NOW(),
+     updated_at TIMESTAMP
  );

Environment Variable Comparison

// .env.staging
DATABASE_URL=postgres://user:pass@staging-db:5432/app
REDIS_URL=redis://staging-redis:6379
LOG_LEVEL=debug
API_KEY=staging-key-123
MAX_CONNECTIONS=10

// .env.production
DATABASE_URL=postgres://user:pass@prod-db:5432/app
REDIS_URL=redis://prod-redis:6379
LOG_LEVEL=warn
API_KEY=prod-key-456
MAX_CONNECTIONS=50
SENTRY_DSN=https://abc123@sentry.io/789

// Diff:
- DATABASE_URL=postgres://user:pass@staging-db:5432/app
+ DATABASE_URL=postgres://user:pass@prod-db:5432/app
- REDIS_URL=redis://staging-redis:6379
+ REDIS_URL=redis://prod-redis:6379
- LOG_LEVEL=debug
+ LOG_LEVEL=warn
- API_KEY=staging-key-123
+ API_KEY=prod-key-456
- MAX_CONNECTIONS=10
+ MAX_CONNECTIONS=50
+ SENTRY_DSN=https://abc123@sentry.io/789

Character-Level Diff (Inline)

// Line-level diff shows the line changed:
- const apiUrl = "https://api.example.com/v1/users";
+ const apiUrl = "https://api.example.com/v2/users";

// Character-level diff shows exactly what changed within the line:
const apiUrl = "https://api.example.com/v[1→2]/users";

Whitespace-Ignored Diff

// With whitespace differences ignored, these are treated as identical:

// Version A (2-space indent)
function add(a, b) {
  return a + b;
}

// Version B (4-space indent)
function add(a, b) {
    return a + b;
}

// Diff with whitespace ignored: no differences found
// Diff with whitespace shown: indentation change on line 2

Diff Statistics Summary

// Example diff statistics output:
Lines added:    12
Lines removed:   8
Lines unchanged: 45
Total changes:  20
Similarity:     69%

// For character-level:
Characters added:    87
Characters removed:  54
Characters unchanged: 1,203

Common Use Cases

Paste your two texts into the Text Diff Checker and instantly see every addition, deletion, and change highlighted in color.

Frequently Asked Questions

Simply enter your data, click the process button, and get instant results. All processing happens in your browser for maximum privacy and security.

Yes! Text Diff Checker is completely free to use with no registration required. All processing is done client-side in your browser.

Absolutely! All processing happens locally in your browser. Your data never leaves your device, ensuring complete privacy and security.