Skip to main content

    Text Diff Checker

    Compare two texts side by side and see exactly what changed. Highlights additions, deletions, and unchanged lines.

    Free to use. Runs in your browser.

    Paste two versions of text to see additions (green) and deletions (red) highlighted line by line.

    Both texts are compared in your browser, nothing is uploaded.

    What Is a Text Diff and Why Developers Use It Daily

    A diff (short for "difference") shows you exactly what changed between two pieces of text. Added lines, deleted lines, and modified lines, all highlighted clearly so you don't have to squint at two versions side by side. It's the foundation of every code review, every version control system, and every "track changes" feature.

    Git uses diffs internally to track every change you've ever made. When you run "git diff", you see the same kind of output this tool generates. Code review tools like GitHub and GitLab display diffs to help teams review changes before they're merged.

    This tool isn't just for code. Compare two versions of a contract, spot differences in API responses, verify config file changes, or check if two "identical" texts are actually identical. Paste the original on the left, the modified version on the right, and see every difference instantly.

    Diff Algorithms Compared

    AlgorithmHow It WorksBest For
    Line-by-lineCompares entire lines as unitsCode files, config files, structured text
    Word-by-wordCompares individual words within linesProse, documentation, content changes
    Character-by-characterCompares every single characterFinding typos, subtle whitespace differences
    Myers (Git default)Finds shortest edit distance between textsGeneral purpose, produces minimal diffs
    PatienceMatches unique lines first, then fills gapsCode with many similar lines (HTML, CSV)

    What this means for you: This tool uses a line-level diff built on the Longest Common Subsequence approach, the same granularity Git shows by default, which keeps code and config comparisons readable. To spot a subtle change within a line, split or format the text so the change lands on its own line before comparing.

    Practical Uses for Text Diffs

    Comparing API responses

    Getting different results from an API call? Paste both responses and see exactly which fields changed. Great for debugging staging vs production differences.

    Verifying config changes

    Before deploying a config change, diff the old and new versions. This catches accidental modifications, a misplaced comma in JSON or a typo in a database connection string.

    Document version comparison

    Compare two versions of a legal document, specification, or email draft. The diff highlights the lines that were added, removed, or changed, so you can see what differs at a glance.

    Finding hidden characters

    Two strings look identical but aren't equal? A diff can reveal invisible differences: trailing spaces, tab-vs-space issues, different line endings (CRLF vs LF), or zero-width characters.

    Understanding Diff Output

    IndicatorMeaningWhat To Look For
    + Added (green)Text exists in the new version but not the oldNew features, additions, expansions
    - Removed (red)Text existed in the old version but was deletedDeleted code, removed features
    Changed lineShows as a red removed line plus a green added lineAn edit is a delete plus an add
    UnchangedIdentical in both versionsContext, helps you orient yourself

    How This Tool Compares Text

    Both texts are split into lines, then matched with a Longest Common Subsequence algorithm, the classic approach behind most diff tools. Lines that appear in both versions are marked unchanged; lines only in the modified text are additions; lines only in the original are deletions.

    There is no separate "modified" marker. When a line is edited, the old version shows as a red deletion and the new version as a green addition, sitting next to each other. Reading the pair together tells you what changed.

    Whitespace counts. A line with a trailing space is different from one without, and Windows line endings (CRLF) differ from Unix ones (LF). That strictness is what makes the tool useful for hunting invisible differences, but for prose where spacing does not matter, trim your text first. The summary at the top tallies how many lines were added, removed, and left unchanged.

    Reading a Diff: A Worked Example

    Say you tweak a small config block. Here are the two versions and the diff the tool produces.

    Original
    const port = 3000;
    const host = "localhost";
    app.listen(port);
    Modified
    const port = 8080;
    const host = "localhost";
    app.listen(port, host);
    - const port = 3000;
    + const port = 8080;
      const host = "localhost";
    - app.listen(port);
    + app.listen(port, host);

    The unchanged middle line anchors the comparison, and each edited line appears as a delete followed by an add. The summary would read two added, two removed, one unchanged.

    What a Line Diff Will and Will Not Catch

    A line-level diff is fast and readable, but it helps to know its blind spots so you can read the output with the right expectations.

    It catches

    Added and removed lines, edited lines (as a delete plus an add), and invisible differences such as trailing spaces, mixed tabs and spaces, and CRLF versus LF line endings.

    It will not tell you

    Exactly which characters changed inside a line (the whole line is flagged), and it does not recognise a moved block as a move, so a paragraph shifted up or down shows as a deletion in one place and an addition in another.

    None of this is a fault, it is how line diffs work everywhere, including Git. When you need to see a within-line edit, split the line so the change sits on its own row before comparing.

    Tips for Cleaner Diffs

    • Format JSON first. Pretty-print both sides so every key sits on its own line, then a one-field change shows as a single line rather than one giant line marked as different.
    • Normalise line endings. If a whole file shows as changed for no obvious reason, mismatched CRLF and LF endings are the usual cause. Convert both to the same style first.
    • Trim prose before comparing. For documents where spacing is not meaningful, remove trailing spaces so real wording changes stand out instead of whitespace noise.
    • Sort keys or lines when order does not matter. Comparing two lists that hold the same items in a different order? Sort both first so the diff shows genuine differences, not reordering.

    Related Tools

    How to use this tool

    1

    Paste the original text in the left box

    2

    Paste the modified text in the right box

    3

    Click Compare to see additions, deletions, and unchanged lines

    Common uses

    • Comparing API response versions during debugging
    • Reviewing config file changes before deployment
    • Checking document revisions for content differences
    • Finding hidden character differences in strings

    Share this tool

    Frequently Asked Questions

    How does the diff checker work?
    It compares your two texts line by line using an LCS (Longest Common Subsequence) algorithm. Added lines show in green, deleted lines in red, and unchanged lines appear uncoloured. Git shows the same kind of line-by-line view, though its default uses the related Myers algorithm.
    Is my text sent to a server?
    No. All comparison runs locally in your browser using JavaScript. Your texts never leave your device. There are no server calls, no storage, and no tracking.
    Can it compare code?
    Yes. It works with any text: code (JavaScript, Python, SQL), config files (JSON, YAML, .env), prose, CSV data, and HTML. The line-by-line comparison is especially useful for code reviews.
    Does it handle large files?
    It handles texts up to roughly 100,000 characters efficiently. Very large files (500K+ characters) may cause a brief pause. For massive files, consider using command-line diff or a dedicated diff tool like Beyond Compare.
    Can I find invisible character differences?
    Yes. If two strings look identical but aren't equal, the diff reveals invisible differences: trailing spaces, tab-vs-space issues, different line endings (CRLF vs LF on Windows/Mac), or zero-width Unicode characters.
    What's the difference between this and Git diff?
    Git diff compares files in a repository with context about commits and branches. This tool compares any two texts directly, no Git needed. Both use similar underlying algorithms (LCS-based), but this tool is simpler and runs in your browser.
    Can I compare JSON responses?
    Yes, and it's one of the most common use cases. Format both JSON strings first (use our JSON Formatter) so each key is on its own line, then paste them here. The diff will show exactly which fields changed.
    How do I read the diff output?
    Lines starting with + (green) were added in the modified text. Lines starting with − (red) were removed from the original. Lines with no marker are unchanged. The summary shows total added, removed, and unchanged lines.
    Does it do word-level or character-level diff?
    This tool does line-level comparison, it identifies which lines changed. For word-level or character-level differences within a line, you'd need a more specialised tool. Line-level is the standard for code comparison.
    Can I compare database query results?
    Yes. Export your results as CSV or text, paste both versions, and compare. This is great for verifying that a query change produces the expected output differences.
    What about whitespace differences?
    The tool treats whitespace as significant by default, a line with a trailing space is different from one without. This is usually what you want for code. For prose comparison where whitespace doesn't matter, trim your text first.
    Can I save or share the diff result?
    Currently the diff is displayed in your browser only. You can screenshot it or copy the output. For shareable diffs, consider creating a GitHub Gist or using a service like pastebin.

    Results are for general informational purposes only and should be checked before use. They are not professional advice. See our Disclaimer and Terms of Service.