Text difference analysis engine

Diff Checker Text difference comparison tool

Compare the differences between two pieces of text, code, JSON, or AI prompts. Supports three comparison modes: Line / Word / Character.

|
Original0 lines
Modified0 lines

Frequently Asked Questions (FAQ)

What is Diff?
Diff is the abbreviation of difference, which refers to comparing two pieces of text to find out the added, deleted and modified parts. Diff tools are widely used in program code version control (such as Git diff), document proofreading, and data comparison. Its core algorithm is based on the Longest Common Subsequence (LCS), which can accurately locate which content has been added, removed or changed.
What is the difference between Line Diff, Word Diff and Character Diff?
Line Diff: Comparing line-by-line changes is most suitable for code and structured text changes, and is the most commonly used Diff mode.

Word Diff: Compare in word units, suitable for article proofreading and Prompt comparison, and can be accurate to the change of each word.

Character Diff: Compare in units of characters. The most refined comparison mode can show the increase or decrease of each character, but it may be difficult to read for a large amount of text.

Recommendation: Use Line Diff for code, Word Diff for articles, and Character Diff when you need to pinpoint spelling changes.
Best practices for JSON Diff?
After turning on "JSON mode", the tool will automatically format and sort the JSON on both sides and then compare them. This can avoid misjudgments caused by indentation and key value order.

It is recommended to also turn on the "Ignore whitespace" option when comparing JSON to obtain cleaner comparison results. If there are dynamic values ​​in the JSON such as timestamps or UUIDs, they can be normalized before comparison.
How is similarity calculated?
The similarity is calculated using the longest common subsequence (LCS) algorithm, and the formula is:

Similarity = (2 × LCS長度) / (左文字長度 + 右文字長度) × 100%

This metric is also called the Díce coefficient, and the closer the value is to 100%, the more similar the two paragraphs are. Generally speaking:
• 100%: exactly the same
• 80-99%: Minor revisions
• 50-79%: Substantial revisions
• < 50%: Mostly different
How do you compare AI-generated content?
This tool will automatically detect whether the input content is an AI prompt (system prompt words, character settings, etc.) and display the Token estimate and Prompt-specific statistics. When comparing AI-generated content, it is recommended to use Word Diff mode, as LLM output often differs in synonyms and sentence structure.

Common usage scenarios include:
• Compare output differences between different versions of Prompt
• Compare LLM responses for A/B testing
• Compare model output before and after fine-tuning
How does Diff work in Git?
Git uses a built-in diff engine to track file changes. when you execute git diff When , Git will compare the contents of the working directory and the staging area (or between two commits) and display the differences in a unified format (Unified Diff). This tool provides a similar but more visual comparison experience, supports simultaneous scrolling and color marking, and is suitable for operations that are unfamiliar with the command line.

A Complete Guide to Diff Comparison

Choose the appropriate Diff mode

📝 Line Diff

Code, document versions, structured text
Advantages: fast, clear
Disadvantage: Cannot see inline changes

🔤 Word Diff

Article, prompt, proofreading
Advantages: Accurate to single word changes
Disadvantages: Operations on long text are heavy

✏️ Character Diff

Spell check, minor changes
Advantages: most accurate
Disadvantages: Difficult to read with large amounts of text