Diff Viewer
Compare two blocks of text or code line-by-line with additions and deletions highlighted.
Text comparison runs entirely in your browser. Neither the original nor the modified text is sent to CodeAva servers or stored between sessions. Avoid pasting confidential source code or credentials into any online tool.
Overview
A diff viewer compares two versions of the same text side by side and shows exactly what changed — which lines were added, which were removed, and which stayed the same. The output is a line-by-line annotated view where additions are highlighted in green and deletions in red, making it easy to spot changes at a glance without reading every line manually.
This tool implements the Longest Common Subsequence (LCS) algorithm — the same underlying approach used by diff and Git. Each line is compared as a unit: if the text on a line changed at all, the old line is shown as removed and the new line as added. Line numbers from both versions are shown alongside the diff for easy reference.
The diff viewer works on any text: prose, configuration files, JSON, source code, SQL, markdown, or anything else you can paste as plain text. The comparison is case-sensitive and whitespace-aware, which means a line with only a trailing space difference will still show as changed.
Use cases
When to use it
- Reviewing copy updatespaste the old and new version of a piece of text to confirm what actually changed.
- Comparing config filesspot differences between two environment configs, package.json files, or infrastructure definitions.
- Checking generated outputcompare expected vs actual output from a script, API, or code generator.
- Spotting accidental editsconfirm that a file has only the intended changes and nothing else was modified.
- Validating content migrationscompare source and destination text after a CMS export, translation, or format conversion.
When it's not enough
- Full code review workflowsfor reviewing pull requests with many files and context, use your version control system's built-in diff interface.
- Merge conflict resolutionthree-way merges and conflict markers require a dedicated merge tool, not a two-way line diff.
- Semantic code comparisona line diff cannot tell you whether two functions are logically equivalent — that requires code analysis, not text comparison.
How to use it
- 1
Paste the original text
Add the baseline version — the text before changes — into the Original panel on the left.
- 2
Paste the modified text
Add the updated version into the Modified panel on the right. The diff updates immediately.
- 3
Review the diff output
Green lines (+ icon) are additions in the modified version. Red lines (− icon) are removals from the original.
- 4
Check the line numbers
Each diff row shows the line number from the original (left column) and the modified (right column) to help you locate changes in context.
- 5
Use the stats summary
The header of the diff panel shows the total number of added and removed lines as a quick change summary.
Common errors and fixes
Seeing changes when the text looks the same
Whitespace is significant. A trailing space, mixed indentation (tabs vs spaces), or a different line ending (CRLF vs LF) will register as a changed line. Check your source for invisible differences.
Every line shows as removed and re-added
This usually means the two texts use different line endings. Windows-style CRLF line endings pasted into a Unix-style context will make every line appear different. Convert line endings to a consistent format before comparing.
Diff shows more changes than expected
If you are comparing minified code with formatted code, the whitespace and structure differences will dominate the diff. Format both versions consistently before comparing — use the Code Formatter or JSON Formatter tools first.
No differences found even though content differs
Check that both panels are populated. The diff only runs when both fields have content. Also confirm that the texts are not identical — if they are byte-for-byte the same, no diff will be shown.
Assuming a clean diff means the change is safe
A diff tells you what text changed, not whether the change is correct or safe. Always review the semantic meaning of changes, especially for configuration files, scripts, or code where small edits can have large effects.