vasilenko.info

Compare two texts

/en/tool/text-diff/ works compares in the browser

Paste two versions or drag files directly into the fields — the tool will show what was removed, added, and changed within each line. It includes a side-by-side view, line numbers, navigation between change blocks, structural parsing for JSON, XML, and YAML, and file export of the differences. Runs in the browser: neither text nor files are sent anywhere.

promoTwenty years of notes on websitesHow we did it in 2008 and what still works today.Open

Compare two texts

What to count as a comparison unit

By lines — the standard way to compare text versions. By words and by characters — when a paragraph has been rewritten and a line-by-line comparison turns into a wall of replacements. By structure — for JSON, XML and YAML: keys are put in the same order, so reformatting alone is no longer treated as a difference.

What not to count as a difference
Display

A file can be dragged directly into the field.

The following formats are supported: txt, md, csv, json, xml, html, docx, odt and pdf.

Comparison updates as you type. Editing one word is shown as one changed line with the word itself highlighted, not as a pair of “minus — plus”.

“Result link” embeds both texts in the link itself, after the hash. The browser does not send this URL fragment to the server, so the texts stay between you and whoever you share the link with. You can remove them from the URL with the same button.

Similarity

%

Empty

no differences

Keys n and p cycle through difference blocks when focus isn't in an input field. The bar to the right of the listing is an edit map: click a marker to jump to the right place.

line-by-line difference

    Lines on the left
    Lines on the right
    Matching lines
    Changed lines
    Missing lines
    Added lines
    Moved lines
    Difference blocks

    Everything is calculated on your device. Text, files and the link to the result are never sent anywhere: after upload, the page makes no requests at all. Docx, odt, and pdf files are also processed right here in the browser.

    promoCalculate ROI at the same timeCampaign payback based on spend and revenue.Open

    How to use it

    1. Paste the old version on the left and the new version on the right — or drag files into the fields. It reads txt, md, csv, json, xml, html, as well as docx, odt, and pdf: the tool unpacks them and extracts the text itself, in the browser.

    2. Read the listing: a minus means a line was removed, a plus means one was added, and yellow within the line highlights what changed. Blue marks a section that was not removed but simply moved.

    3. Switch to “two columns side by side” if you prefer comparing visually from left to right: empty spaces opposite removed and added lines keep the two sides aligned.

    4. Move through changes with the “previous — next” buttons or the n and p keys. The bar to the right of the listing is a map: its markers show where there are many changes, and you can click them.

    5. If there are more differences than expected, relax the strictness settings: case, indentation, and blank lines. Often it is not the text that differs but trailing spaces left after copying from an editor.

    6. For JSON, XML, and YAML, turn on “Structure”: the data will be parsed and normalized, and differences will be listed as paths such as “items[3].price: 100 → 120”. If both fields are clearly JSON or XML, the tool switches automatically.

    7. You can take the result with you: “.patch” is a standard unified diff for patch and git apply, “highlighted page” is a standalone html file that opens without a network connection, and “as a table” is Markdown markup for a task or email.

    promoBrowser task listNo account required—everything is stored on your device.Open

    The formula and what it includes

    Similarity = (Matching lines + Moved lines + Sum of changed-pair similarities) × 2 ÷ (Lines on the left + Lines on the right) × 100%

    Multiplication by two is needed because a matching line is counted for both texts at once: it appears on the left and on the right. Without it, two identical texts would score 50% instead of 100%. In “by words” and “by characters” modes, the formula is the same, but it uses words or characters instead of lines.

    Example breakdown: a four-line shopping list

    The input data is the same as the default field values: you can calculate it mentally and confirm that the tool is telling the truth.

    1. The first two lines match and appear in both texts in the same order — this is the common subsequence, containing 2 lines.

    2. “Eggs 10 pcs” and “Eggs 20 pcs” are split into words: on the left, “Eggs”, a space, “10”, a space, “pcs”; on the right, the same with “20”. Four out of five words on each side match, so the pair similarity is 4 × 2 ÷ (5 + 5) = 0.8. That is more than 60%, so the line is considered changed, and “10” is highlighted as the only edit.

    3. “Butter 180 g” and “Cheese 200 g” have almost nothing in common: their similarity is 0.5, below the threshold. So this is not one changed line but a removed line and an added line.

    4. All four lines are consecutive, with no matches between them, so there is one difference block.

    5. Similarity: (2 matching + 0 moved + 0.8 for the changed pair) × 2 = 5.6, with 4 + 4 = 8 lines total.

    Similarity = 5.6 ÷ 8 × 100% = 70%. One line changed, one was removed, one was added, and there was one difference block.

    Frequently asked questions

    promoAll toolsForty-four tools, all running in your browser.Open

    Related tools

    3