格 千格 KiloCell

Text Difference Comparison Tool

Pastes two text and immediately view the change content - displays the difference between the line, word or character level by colour.

Text Match

Original text
Revised text
Comparison Results
Click“Start comparison”View Differences...
Ready

In-depth knowledge of text differences (Diff): working principles and application scenarios

Diff (Abbreviations of variances) are the expression of changes between two versions of the text. It can give a precise and bright indication of what has been added, deleted or kept unchanged. The concept is... Git The core of the version control system is equally useful in routine tasks such as comparing document revisions, validating configuration file changes or reviewing editing traces.

Three contrast precision levels

The precision of the comparison between two texts will significantly affect the clarity of the results:

  • Line diff: Each line is considered an atomic unit. If in one paragraph 100 text, the entire line is marked as deleted and the modified version is shown as added. It's a code comparison. git diff The standard model, because the code is meant to be line-oriented.
  • By word (Word diff): In the paragraphs where changes are made, further highlighting of specific word changes is indicated. It reveals which word has been replaced, added or deleted. - It is very appropriate to compare the text, legal text or document, since these content is structured as sentences and paragraphs, not code lines.
  • Compared by character (Character diff): Every character is highlighted. It's the most sophisticated model of the-- Perfect for finding missing commas, extra spaces, transliterated letters, or looks like ASCII. But this is not the Unicode character.

Myers ' workbook for differential algorithms

At the bottom, our tools are used. Myers Difference Algorithm This is also the algorithm used by Git. The algorithm is to search for the shortest edit scripts - Working on the minimum number of insertions and deletions required for the conversion of one text to another. It's like looking for two entries. Maximum public subseries (LCS) , and mark content that does not belong to LCS as inserted or deleted.

Myers is very efficient because it uses the observation that most of the actual differences are short-lived — The two documents are mostly similar, with only a small number of different content. The time complexity of algorithms is performed in the best possible circumstances, making it possible to process most of the same text at a fast pace.

Practical application scene

  • Code review: Checks whether only the expected changes have been made, compared with the scripts before and after the changes.
  • Review of legal documents: Compare the two versions of the contract to see which provisions were added, deleted or modified between the drafts.
  • Content Editor: The review of the editorial changes to your first draft article is very desirable at this time of year.
  • Configure Management: Compare the two versions of the server configuration document with the changes that have occurred during deployment.
  • Copying test: Checks whether the two texts are unusually similar by looking at the fine differences between them.
  • Translation review: Ensure that all source text clips are translated accordingly and are not omitted.
  • Data validation: Verifys whether today ' s data export is consistent with yesterday ' s (or whether it changes as expected).

How to Read Compare Output

The result panel uses standard colour protocols:

  • Green Line/Background Organisation New Text – These are new entries.
  • Red Line/Background Organisation Original text – These are deletions.
  • Grey Rows/Text In both texts, it's exactly the same -- these are the unchanged context lines.

Common issues (FAQ)

Is this the exact contrast library?
Exactly. The tool uses a field-tested diff.js library (version 5) and it achieves Myers differential algorithms — and Git uses the same algorithm. It generates very small and accurate differences, running with you in the command line git diff The results are the same.
Can I compare more than two files?
This tool compares only two text versions. For multiple mergers or triangulations, you need a dedicated consolidation tool. But you can contrast it over and over again. vs B, B vs C) to track changes in different versions.
Why do word-to-word comparisons sometimes show the whole sentence as different?
The word-by-word comparison is divided on the basis of the space boundary. If a sentence is completely rewritten and there is no common word, the entire sentence will be shown as a deletion and a new entry. That's technically correct. - Because there is no common word series that can serve as anchors for comparison.
Does this tool support exporting differences to patch files (. Patch)?
Currently, the Copy Result button reproduces a text-sync output. Uniform differences for standards (. Patch) Format, you can manually copy the results - Line beginning with "-" deletes the entry and starts with "+" with a new entry. The full patching format export is already being developed.