Text Diff Checker: Compare Two Texts Line by Line
Spot the differences between two texts, line by line.
Use via API
Compare two texts line by line (Myers diff) and return added, removed and unchanged lines, plus a unified-style text diff. Send JSON, get JSON back.
POST https://pithlab.com/api/v1/tools/text-diff
curl https://pithlab.com/api/v1/tools/text-diff \
-H "Authorization: Bearer $PITHLAB_KEY" \
-H "Content-Type: application/json" \
-d '{"original":"apples\nbananas\ncherries","changed":"apples\nblueberries\ncherries\ndates"}'About the Text Diff Checker
Compare two versions of text or code and see exactly which lines were added, removed or unchanged, with counts. Can ignore case and whitespace. Runs in your browser.
How to use the Text Diff Checker
- Paste the original text on the left and the changed text on the right, or press Example.
- The comparison updates as you type: removed lines are shown in red with a minus sign, added lines in green with a plus sign.
- Tick Ignore case or Ignore whitespace to skip differences you don't care about.
- Copy or download the diff as plain text.
Examples
Input
apples bananas cherries --- apples blueberries cherries dates
Output
apples - bananas + blueberries cherries + dates
Frequently asked questions
How does the comparison work?
It uses the Myers diff algorithm, the same approach behind git diff, to find the smallest set of line insertions and deletions that turns the original into the changed text.
Why is a whole line marked as changed when I edited one word?
This tool compares whole lines, so any change within a line shows as that line removed and its new version added. Placing the two versions next to each other makes the edited word easy to spot.
Do different line endings count as differences?
No. Windows (CRLF), Unix (LF) and old Mac (CR) line endings are treated the same, and a missing final newline is ignored.
Is there a size limit?
Each side can be up to 500,000 characters. Very different texts with thousands of separate changes are refused rather than freezing your browser; compare smaller sections instead.