Text Diff Tool
Pricing
Pay per event
Text Diff Tool
Compare two text blocks via API. Get line-by-line, word-level, or character-level diffs with unified format output, change statistics, and structured JSON results. Like the diff command as a service.
Pricing
Pay per event
Rating
0.0
(0)
Developer
Stas Persiianenko
Actor stats
0
Bookmarked
2
Total users
1
Monthly active users
2 days ago
Last modified
Categories
Share
Compare two text blocks and extract differences via API. Supports line-by-line, word-level, and character-level comparison with unified diff output, change statistics, and a structured changes array — like a diff command accessible anywhere via HTTP.
What does Text Diff Tool do?
Text Diff Tool compares two text inputs and returns the differences in multiple formats. You provide Text A (the original) and Text B (the modified version), choose a diff granularity (lines, words, or characters), and the actor returns:
- A unified diff string (the classic
diffformat developers know) - A structured changes array listing every added, removed, and unchanged segment
- Statistics: how many lines/words/chars were added, removed, and unchanged
- A human-readable summary like "3 lines added, 2 lines removed, 15 lines unchanged"
You can paste text directly into the input fields, or supply URLs to remote text files — the actor fetches and compares them automatically.
No browser, no proxy, no external API calls (unless you supply URLs). Pure computation — runs in under a second for most inputs.
Who is Text Diff Tool for?
🧑💻 Developers and DevOps engineers
Building a pipeline that compares config files, log outputs, or API responses? Use this actor as a diff microservice:
- Compare two Kubernetes YAML files and get a structured JSON diff
- Detect changes between two API response snapshots
- Verify that a deployment didn't change unexpected files
🤖 Automation builders (Zapier, Make, n8n)
Need to trigger an action only when something actually changed?
- Fetch a webpage's content (via another scraper), compare to last week's version
- Get the diff via this actor, check
hasChanges, trigger notification only if true - Store the
unifiedDiffin Notion or Airtable for change tracking
📊 Data analysts and researchers
Tracking how a dataset or document evolves over time:
- Compare two versions of a terms-of-service document to see what legal language changed
- Diff two CSV exports to find new or removed rows
- Compare two transcripts to spot edits
🧪 QA engineers and testers
Testing that expected output matches actual output:
- Compare expected vs actual output of a script
- Check that a document transformation preserved the right content
- Validate that a template renderer produced the expected text
Why use Text Diff Tool?
- ✅ No setup required — just paste two texts and run
- ✅ Three diff granularities — lines, words, or characters
- ✅ Structured JSON output — not just a raw diff string; every change is a typed object
- ✅ Unified diff format — compatible with all standard diff viewers
- ✅ URL support — fetch and compare remote text files automatically
- ✅ Case-insensitive and whitespace-insensitive modes — flexible comparison
- ✅ Pure HTTP actor — no browser overhead, low cost, fast startup
- ✅ API-first — integrate into any pipeline in seconds
- ✅ Scheduling — run on a schedule to detect changes over time
- ✅ Export — results in JSON, CSV, or Excel via Apify platform
What data can you extract?
| Field | Description |
|---|---|
diffType | Diff granularity used: lines, words, or chars |
hasChanges | Boolean — true if any differences were found |
stats.added | Number of lines/words/chars added |
stats.removed | Number of lines/words/chars removed |
stats.unchanged | Number of lines/words/chars unchanged |
linesAdded | Flat copy of stats.added for easy table display |
linesRemoved | Flat copy of stats.removed for easy table display |
linesUnchanged | Flat copy of stats.unchanged for easy table display |
unifiedDiff | Full unified diff string (standard diff -u format) |
changes | Array of change objects with type, value, and lineNumber |
summary | Human-readable summary of all changes |
Change object structure
Each item in the changes array has:
{"type": "added" | "removed" | "unchanged","value": "the text content of this segment","lineNumber": 3}
How much does it cost to compare text?
This Actor uses pay-per-event pricing — you pay only for what you compute. No monthly subscription. All platform costs are included.
| Free | Starter ($29/mo) | Scale ($199/mo) | Business ($999/mo) | |
|---|---|---|---|---|
| Per diff | $0.01115 | $0.01100 | $0.01078 | $0.01060 |
| 100 diffs | $1.115 | $1.10 | $1.078 | $1.060 |
| 1,000 diffs | $11.15 | $11.00 | $10.78 | $10.60 |
Pricing = $0.01 start fee + $0.001 per diff (BRONZE tier). FREE tier pays $0.00115 per diff.
Higher-tier plans get additional volume discounts.
Real-world cost examples:
| Input | Results | Duration | Cost (Free tier) |
|---|---|---|---|
| Two short texts (5 lines each) | 1 diff | < 1s | ~$0.01115 |
| Two medium documents (500 lines each) | 1 diff | < 1s | ~$0.01115 |
| 100 automated comparisons | 100 diffs | < 2 min | ~$1.115 |
On the free plan ($5 credits), you can run approximately 448 diff comparisons before spending your credits.
How to compare two text blocks
- Go to Text Diff Tool on Apify Store
- Click Try for free
- Paste your original text into the Text A field
- Paste your modified text into the Text B field
- Choose a diff type: Line-by-line (default), Word-by-word, or Character-by-character
- Optionally set context lines (default 3) and toggle case/whitespace sensitivity
- Click Start and wait for results (usually under 3 seconds)
- Download results as JSON, CSV, or Excel — or use the API for automation
Input example: comparing two config files
{"textA": "server:\n port: 8080\n host: localhost\n timeout: 30","textB": "server:\n port: 9090\n host: 0.0.0.0\n timeout: 60","diffType": "lines","contextLines": 2}
Input example: comparing URLs
{"textA": "https://example.com/old-config.txt","textB": "https://example.com/new-config.txt","diffType": "lines"}
Input example: word-level diff with case ignored
{"textA": "The Quick Brown Fox","textB": "the quick RED fox","diffType": "words","ignoreCase": true}
Input parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
textA | string | required | Original/base text. Can be plain text or a URL to fetch. |
textB | string | required | Modified text to compare against textA. Can be plain text or a URL. |
diffType | string | "lines" | Granularity: "lines", "words", or "chars" |
contextLines | integer | 3 | Number of context lines around changes in unified diff. Set 0 for changes only. |
ignoreCase | boolean | false | Treat uppercase and lowercase as equal. |
ignoreWhitespace | boolean | false | Ignore leading/trailing whitespace and collapse multiple spaces. |
outputFormat | string | "full" | "full" returns unified diff + changes array + stats. "stats" returns counts only. |
Output examples
Full output (lines diff)
{"diffType": "lines","hasChanges": true,"stats": {"added": 2,"removed": 2,"unchanged": 3},"linesAdded": 2,"linesRemoved": 2,"linesUnchanged": 3,"unifiedDiff": "Index: text\n===\n--- text\tText A\n+++ text\tText B\n@@ -1,5 +1,5 @@\n Hello world\n-This is the original text\n+This is the modified text\n Line three remains the same\n-Line four will be removed\n+A new line was added\n Final line","changes": [{ "type": "unchanged", "value": "Hello world\n", "lineNumber": 1 },{ "type": "removed", "value": "This is the original text\n", "lineNumber": 2 },{ "type": "added", "value": "This is the modified text\n", "lineNumber": 2 },{ "type": "unchanged", "value": "Line three remains the same\n", "lineNumber": 3 },{ "type": "removed", "value": "Line four will be removed\n", "lineNumber": 4 },{ "type": "added", "value": "A new line was added\n", "lineNumber": 4 },{ "type": "unchanged", "value": "Final line", "lineNumber": 5 }],"summary": "2 lines added, 2 lines removed, 3 lines unchanged"}
Stats-only output
{"diffType": "lines","hasChanges": true,"stats": { "added": 2, "removed": 2, "unchanged": 3 },"linesAdded": 2,"linesRemoved": 2,"linesUnchanged": 3,"unifiedDiff": "","changes": [],"summary": "2 lines added, 2 lines removed, 3 lines unchanged"}
Tips for best results
- 🚀 Start with line diff — it's the most useful for most use cases and produces a standard unified diff output
- 🔍 Use word diff for prose — when comparing articles, documentation, or any natural language text, word-level diff shows changes more meaningfully than line-level
- 🔤 Use char diff for code — when comparing short strings or identifiers where every character matters
- 📏 Reduce context lines for large texts — set
contextLines: 0to get only the changed blocks without surrounding context; saves tokens in API responses - ⬜ Enable ignoreWhitespace for config files — YAML and similar formats can have cosmetic whitespace changes; ignore them to find real differences
- 🔡 Enable ignoreCase for user-facing text — useful when comparing content that may have been copy-edited for capitalization
- 📡 Use URL inputs for automated monitoring — combine with Apify scheduling to detect when a remote file changes weekly or daily
- 💾 Use stats-only mode for existence checks — if you only need to know whether something changed (not what),
outputFormat: "stats"is slightly faster and returns less data - 📊 Pipe output to Google Sheets — use Apify's Google Sheets integration to log diffs over time and track document evolution
Integrations
Text Diff Tool → Slack/Discord change alert
Schedule Text Diff Tool to compare two versions of a document weekly. Use Apify webhooks to trigger a Slack or Discord message when hasChanges: true. Attach the summary field for a quick change overview.
Text Diff Tool → Google Sheets change log
Run Text Diff Tool daily on fetched web content. Push each result to a Google Sheets row via Make or Zapier, including linesAdded, linesRemoved, and summary. Build a timeline of how a document or page evolves.
Text Diff Tool → Notion database
Use Make to run Text Diff Tool on document pairs and create a Notion database entry for each diff result — attaching unifiedDiff as a code block and summary as the record title.
Text Diff Tool → CI/CD pipeline
Call the Apify API directly from a GitHub Actions workflow to diff expected vs actual output of a build step. Fail the workflow if hasChanges: true.
Text Diff Tool with scheduled runs
Set up a scheduled run on Apify to compare the same two URLs daily. Use the hasChanges flag as a webhook trigger to alert your team when the content diverges.
Using the Apify API
Node.js
import { ApifyClient } from 'apify-client';const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });const run = await client.actor('automation-lab/text-diff-tool').call({textA: 'Hello world\nThis is version one',textB: 'Hello world\nThis is version two',diffType: 'lines',contextLines: 3,});const { items } = await client.dataset(run.defaultDatasetId).listItems();console.log(items[0].summary);// "1 line added, 1 line removed, 1 line unchanged"
Python
from apify_client import ApifyClientclient = ApifyClient(token="YOUR_API_TOKEN")run = client.actor("automation-lab/text-diff-tool").call(run_input={"textA": "Hello world\nThis is version one","textB": "Hello world\nThis is version two","diffType": "lines","contextLines": 3,})items = client.dataset(run["defaultDatasetId"]).list_items().itemsprint(items[0]["summary"])# "1 line added, 1 line removed, 1 line unchanged"
cURL
# Start the actor runcurl -X POST "https://api.apify.com/v2/acts/automation-lab~text-diff-tool/runs?token=YOUR_API_TOKEN" \-H "Content-Type: application/json" \-d '{"textA": "Hello world\nThis is version one","textB": "Hello world\nThis is version two","diffType": "lines"}'# Fetch results (replace DATASET_ID with the ID from the run response)curl "https://api.apify.com/v2/datasets/DATASET_ID/items?token=YOUR_API_TOKEN"
Use with AI agents via MCP
Text Diff Tool is available as a tool for AI assistants that support the Model Context Protocol (MCP).
Add the Apify MCP server to your AI client — this gives you access to all Apify actors, including this one:
Setup for Claude Code
$claude mcp add --transport http apify "https://mcp.apify.com"
Setup for Claude Desktop, Cursor, or VS Code
Add this to your MCP config file:
{"mcpServers": {"apify": {"url": "https://mcp.apify.com"}}}
Your AI assistant will use OAuth to authenticate with your Apify account on first use.
Example prompts
Once connected, try asking your AI assistant:
- "Use automation-lab/text-diff-tool to compare these two config files and tell me what changed"
- "Run a word-level diff between these two paragraphs and summarize the differences"
- "Fetch https://example.com/old.txt and https://example.com/new.txt and diff them line by line"
Learn more in the Apify MCP documentation.
Is it legal to use Text Diff Tool?
Yes. Text Diff Tool operates entirely on data you provide — it does not scrape any website unless you explicitly supply a URL as input. When fetching remote URLs, please ensure you have the right to access and process that content. The actor only reads publicly accessible resources.
This tool performs pure text comparison and does not store your input data beyond the duration of the run. All results are stored in your Apify dataset and accessible only to you.
Always comply with applicable data privacy laws (GDPR, CCPA) when processing text that may contain personal information.
FAQ
How fast is it?
Text Diff Tool is near-instant. Most comparisons complete in under 1 second. Even large documents (10,000+ lines) are typically processed in under 3 seconds. There is no browser launch, no proxy overhead — just pure computation.
How much does it cost?
You pay $0.01 per run (start fee) plus $0.001 per diff computed (BRONZE/Starter tier). On the free plan, $5 in credits gives you approximately 448 diff runs. See the pricing section above.
How is this different from just using the diff command?
The diff command only runs locally. Text Diff Tool is accessible via HTTP API, schedulable, integrates with 5,000+ apps via Zapier and Make, and returns structured JSON instead of plain text output. It's the diff command as a service — embeddable in any workflow regardless of platform.
Why does my word diff show unexpected counts?
Word diff counts each token (including spaces and punctuation) separately. The stats.added and stats.removed counts reflect the total length of changed tokens, not just the word count. Use the changes array to see exactly what changed.
Why is my URL input returning an error?
Make sure the URL returns plain text (not HTML or binary content). The actor fetches the URL and treats the response body as text. If the server returns HTML, the diff will compare raw HTML markup. For best results with URLs, use direct links to .txt, .json, .yaml, .csv or similar text files.
What's the maximum text size I can compare?
There is no hard limit enforced by the actor. However, very large texts (megabytes) may hit the 256 MB memory limit. For texts over 500 KB, consider splitting into sections and running multiple comparisons.
Other developer tools
Explore other useful developer utilities from automation-lab:
- Broken Link Checker — Scan any website for broken links and HTTP errors
- Canonical URL Checker — Validate canonical tags across your site
- Robots.txt & Sitemap Analyzer — Inspect robots.txt rules and sitemap structure
- DNS Record Checker (DMARC) — Check DMARC email authentication records
- SPF Record Checker — Validate SPF DNS records for email domains
- Domain Availability Checker — Check if domain names are available to register
- Website Uptime Checker — Monitor website availability and response times
- Cookie Scanner — Audit cookie usage and consent compliance