Text Diff Tool
Paste two versions of a text to see the line and character differences.
Result
How it is calculated
Both texts are split into lines. The tool finds the longest set of identical lines that appear in the same order in both (a longest common subsequence). Those are the unchanged lines; added = lines in B − common and removed = lines in A − common. A line that was edited therefore counts as one removed plus one added. Lines must match exactly, including case and spaces. The character figure is the Levenshtein distance: the fewest single-character insertions, deletions and substitutions that turn A into B. It is computed on bytes, so an accented letter such as é counts as 2, and when either text is longer than 4,000 characters the character figure shows “—” (the line counts are still given). At least one box must contain text.
Worked example
Text A has 3 lines: "The cat sat", "on the mat", "The end". Text B has 4 lines: "The cat sat", "on the rug", "The end", "Bye". Two lines match in order, so common is 2 lines. B has 4 − 2 = 2 lines added (the rug line and Bye), and A has 3 − 2 = 1 lines removed (the mat line). Characters: mat becomes rug with 3 substitutions, and the line break plus Bye needs 4 insertions, so 7 chars in total.
Common mistakes
- Expecting an edited line to be counted as one change. It appears as one line removed and one added.
- Ignoring invisible differences. A trailing space, a tab or a different capital letter makes two lines unequal.
- Comparing texts with different line endings or wrapping. A paragraph broken at different widths is seen as completely different lines.
- Treating the character count as a count of words changed. It counts single characters, so one replaced word can be several changes.
- Relying on the character distance for very long texts. Above 4,000 characters in either box it shows “—”; only the line counts are given.
About this calculator
This tool compares two blocks of text on two levels: a line-level diff, which reports how many lines were added, removed, or left unchanged between the two versions, and a character-level edit distance (Levenshtein distance), which counts the minimum number of single-character insertions, deletions, and substitutions needed to turn one text into the other.
Software developers use line diffs constantly when reviewing code changes in version control, while writers, editors and translators use the same comparison to spot exactly what changed between two drafts of a document — the character-level distance adds a finer-grained view for catching small wording or formatting edits that a line-by-line comparison alone would report as a single “changed line.”
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments (1)
For texts over 4,000 characters on either side, the character count is not calculated: the tool shows a dash there, while the line counts stay exact. For big documents, trust the lines and compare sections separately if you also want a character figure for each part. Remember that an edited line counts as one removed and one added. What kind of text do you compare most: code, contracts or drafts?