Text Diff Viewer
Compare two pieces of text side-by-side or unified with line- and word-level highlighting.
- diff
- compare
- text
- patch
- merge
- unified diff
- side by side
- changes
About Text Diff Viewer
A text diff highlights what changed between two versions of a document — which lines were added, which were removed, and within a changed line, which specific words shifted. It's the same primitive Git uses to show pull request changes, that operating systems use to apply patches, and that anyone reviewing a contract or a piece of copy reaches for when "is this different?" is the question.
This viewer pairs two text inputs and runs the Myers diff algorithm (via the jsdiff library) at line granularity, then re-diffs each pair of changed lines at the word level to highlight the specific edits inline. View it side by side to read the before and after in parallel, or in a unified format that mirrors how Git and "patch" output diffs.
How to use
Paste your original text into the left textarea and the changed text into the right. The diff updates live as you type — additions are highlighted green, removals red, and within a changed line the specific changed words get a darker tint so you can spot small edits inside long sentences.
Toggle between Side-by-side (best for proofreading and content review) and Unified (best for code-style reviews where you want to read changes inline). The "Ignore trailing whitespace" toggle uses jsdiff's trimmed-line comparison — useful when one file has trailing spaces or CRLF vs LF differences you want to ignore. "Copy unified diff" copies the patch-style output that you can paste into a code review comment or save as a .diff file.
Frequently asked questions
What algorithm does this use?
The Myers diff algorithm, the same one used by Git, GitHub, GitLab, and most diff tools in the Unix lineage. It finds the shortest edit script — the smallest set of insertions and deletions that turns one text into the other. The line-level diff runs Myers on lines; the inline word-level highlights re-run Myers on the paired removed/added line content tokenised into words, which gives readable highlights inside changed lines.
Why are some "changed" lines shown as separate add + remove instead of an inline edit?
Because the line-level Myers algorithm only knows about exact line matches — if any character on a line differs, the whole line is "removed and replaced." The side-by-side view pairs adjacent removed and added blocks and re-diffs them word-by-word for the inline highlights. If the edit added or removed several lines around a change, the alignment may show lone added or removed lines with empty placeholders on the opposite side.
What's "Ignore trailing whitespace"?
It switches the line comparison to ignore whitespace at the end of each line, so lines that differ only in trailing spaces, tabs, or carriage returns (CRLF vs LF) compare as equal. Useful when comparing files between Windows and Unix line endings, or after running a formatter that may have changed trailing whitespace as a side effect.
Can I paste in code with curly braces and quotes?
Yes — the textareas accept any text including code, JSON, XML, prose with smart quotes, emoji, anything. The diff is character-level under the hood, so nothing gets escaped or modified before comparison. Long single-line input (e.g. minified JSON on a single line) will be diffed as one big "line" — paste pretty-printed code for a more readable diff.
Is anything sent to a server?
No. The diff is computed in your browser using the jsdiff library. Neither textarea's content is uploaded, logged, or persisted to the URL — the URL only stores your view (side-by-side vs unified) and whitespace preference. Refresh the page and your texts are gone; sensitive content stays local.
More Text & Encoding tools
JSON Formatter
Pretty-print, validate, or minify JSON with helpful error positions.
Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to text. UTF-8 safe.
URL Encoder / Decoder
Percent-encode or decode URLs and query parameters.
JWT Decoder
Decode a JSON Web Token to inspect its header and payload.