Text Diff

Compare two blocks of text with line-by-line and word-level highlighting.

No data leaves your browser
Text A
Text B
Paste text in both inputs to see the diff.
Paste text in both inputs to see the diff.

How to use the Text Diff

  1. Paste the original text on the left and the changed text on the right.
  2. Differences highlight line by line, with word-level detail.
  3. Switch between unified and side-by-side views.
  4. Copy the diff or share it as a link.

Why use this Text Diff

  • Compare two texts, code files or configs
  • Line and word level highlighting
  • Unified and split views
  • Nothing is uploaded

Frequently Asked Questions

Is the text diff tool free?

Yes, completely free with no account or signup required.

Is my text safe?

All processing is local in your browser. Your text is never uploaded to any server.

What diff features are included?

Unified diff, side-by-side diff, word-level highlighting, line count stats, and a swap button.

What is a text diff?

A diff compares two pieces of text line by line and highlights which lines were added, removed, or unchanged. It is the same algorithm used by Git and code review tools.

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

Unified diff shows both versions in a single pane with + and - prefixes. Side-by-side shows the original on the left and the modified text on the right, making changes easier to scan visually.

What is word-level diff?

Word-level diff highlights the specific words that changed within a modified line, rather than marking the entire line as changed. Enable it with the Word diff toggle.

How do I compare two code files online?

Paste the original code into the left panel and the modified code into the right panel. Switch to Side-by-side view for an easier code review experience.

What algorithm does the diff tool use?

The tool uses the Myers diff algorithm, the same algorithm used by Git. It finds the shortest edit script — the minimum number of additions and deletions to transform one text into the other.

Can I use this to find merge conflicts?

Yes. Paste the two conflicting versions of a file and the diff will clearly show which lines differ, helping you resolve the conflict manually.

How do I diff JSON or XML?

Paste your JSON or XML into both panels. For cleaner diffs, format both sides first using the JSON or XML formatter on this site before comparing.

How are added and removed lines counted?

The stats bar shows the number of added lines (green), removed lines (red), and unchanged lines. Only real content lines are counted — blank lines are included if present.

More Developer Tools

JSON ToolsValidate, repair, compare & JSONPath JSON FormatterPretty-print and beautify JSON CSV Viewer & EditorView, edit and convert CSV files YAML ConverterConvert YAML to JSON and back Regex TesterTest regular expressions live Text DiffCompare two texts side by side JWT ToolDecode, encode, compare and verify JWTs JWT DecoderInspect JWT header and payload XML FormatterFormat, validate and convert XML URL EncoderEncode, decode and parse URLs Base64Encode and decode Base64 strings Hash GeneratorSHA-256, MD5, HMAC and CRC32 SHA-256Generate SHA-256 checksums MD5 GeneratorGenerate MD5 hash values Text ToolsCase convert, count and transform text Number ConverterBinary, hex and octal converter Token CalculatorEstimate LLM token counts from text PDF EditorEdit text, sign and annotate PDFs Schema GeneratorJSON to TypeScript, Go, Rust, Python IndexNowSubmit URLs to Bing, Yandex & more PII RedactorMask personal data & keys before AI Timestamp ConverterUnix epoch to date and back UUID GeneratorUUID v4/v7, ULID, Nano ID Password GeneratorSecure passwords & passphrases MCP Config BuilderConfigs for Claude, Cursor, VS Code AGENTS.md GeneratorCLAUDE.md, Cursor rules, Copilot AI Crawler Controlsrobots.txt for AI bots & llms.txt Cron ParserExplain crontab, next run times SQL FormatterBeautify & minify SQL queries cURL ConvertercURL to fetch, Python, Go, PHP Chat Export ConverterChatGPT/Claude export to Markdown Markdown PreviewLive GFM preview & to HTML Color & ContrastHEX/RGB/OKLCH, WCAG checker QR Code GeneratorURL, Wi-Fi, vCard; PNG & SVG Image EditorConvert, compress, resize & crop Tool Schema ConverterOpenAI ↔ Anthropic ↔ Gemini ↔ MCP JSONL ValidatorFine-tuning & batch files SSE Stream ParserReassemble LLM streaming responses Prompt Template & DiffFill {{vars}}, compare versions