← Text

Diff Checker

Compare two texts and see the differences line by line. Everything runs in your browser.

Use this tool from AI agents

This tool's engine is available to AI agents over MCP as diff_text. Add the Clean.tools server, then your agent can call it directly.

Claude Code
claude mcp add --transport http clean-tools https://mcp.clean.tools/mcp
Claude Desktop (mcpServers)
{"mcpServers":{"clean-tools":{"command":"npx","args":["-y","@clean-tools/mcp"]}}}
Cursor
https://mcp.clean.tools/mcp

Or call it over plain HTTP from any script. Same engine, JSON in and JSON out, no key:

curl
curl -s https://api.clean.tools/v1/diff_text \ -H 'content-type: application/json' \ -d '{"original":"roses are red\nviolets are blue","modified":"roses are red\nviolets are green"}'
JavaScript
const res = await fetch('https://api.clean.tools/v1/diff_text', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ original: 'roses are red\nviolets are blue', modified: 'roses are red\nviolets are green' }) }); const data = await res.json();

How it works

This diff checker uses a line-level Longest Common Subsequence (LCS) algorithm to compare two texts. It identifies added, removed, and unchanged lines and displays them in a color-coded inline diff. Green lines were added in the modified text, red lines were removed from the original.

All processing happens locally in your browser. Your text is never sent to a server, making it safe for comparing sensitive code, configs, or documents. Works on any modern browser, mobile and desktop. If you would rather diff text from scripts or AI agents, the same engine is available as the diff_text tool through the Clean.tools API and MCP server, or by installing the @clean-tools/mcp package from npm.

Frequently asked questions

Does it compare line by line or character by character?

Comparison is line by line. A change anywhere in a line marks the whole line as removed and the new version as added, rather than highlighting the individual characters that differ. Splitting your text so that each logical item sits on its own line gives the most readable diff.

Does it ignore whitespace and blank lines?

No. Lines must match exactly, including leading and trailing spaces, tabs, and empty lines. Two lines that differ only by a trailing space are treated as a removal plus an addition.

Why does every line show as changed when I compare a Windows file against a Unix one?

Text is split on newline characters, so a Windows carriage return stays attached to the end of each line. Comparing CRLF text against LF text can therefore flag every line as different. Convert both sides to the same line endings first.

Is there a limit on how much text I can compare?

The algorithm builds a table sized to the product of the two line counts, so memory use grows quickly with length. It handles files up to a few thousand lines comfortably, but comparing two very large inputs (tens of thousands of lines each) can slow down or exhaust the browser.

Can I use this from the command line or an AI agent?

Yes. The same diff engine is exposed as a REST endpoint at https://api.clean.tools/v1/diff_text, so you can POST two texts as JSON and get the diff back from any script. It is also an MCP server you can add to Claude, Claude Code, or Cursor so an agent can call it directly. If you prefer to run it locally, the @clean-tools/mcp package on npm launches it as a stdio server.


View all tools

Use Clean.tools from your AI agent

This tool is also diff_text on the Clean.tools MCP server — the same engine, callable by your AI agent directly. No key, no signup: requests are processed in memory and request contents are never stored.

Claude Code
claude mcp add --scope user --transport http clean-tools https://mcp.clean.tools/mcp
Any MCP client (streamable HTTP, authless)
https://mcp.clean.tools/mcp

Every tool, the REST API, and setup for Cursor, Claude Desktop, VS Code & more →