Diff Viewer
Compare two texts side by side and instantly see additions, deletions, and modifications.
About This Tool
The Diff Viewer is a free, browser-based tool that lets you compare two blocks of text and instantly visualize the differences between them. Whether you are reviewing code changes, comparing configuration files, checking document revisions, or verifying migration outputs, this tool makes it easy to spot every addition, deletion, and modification at a glance.
All processing happens entirely in your browser using a custom LCS (Longest Common Subsequence) algorithm implemented in JavaScript. Your data never leaves your machine — there are no server round-trips, no logging, and no third-party services involved. This makes it safe to compare sensitive content such as private keys, environment files, internal documentation, and proprietary source code.
The tool supports three view modes to suit different workflows. Side by Side places the original and modified text in parallel columns, making it easy to scan corresponding lines. Inline interleaves removed and added lines in a single column with clear color-coded markers. Unified produces the classic unified diff format familiar to Git users, ready to be copied and shared.
Beyond line-level comparison, the diff viewer performs character-level highlighting within modified lines. Changed characters are marked with a distinct background color so you can pinpoint the exact edits without reading the entire line. A summary bar shows counts of added, removed, modified, and unchanged lines so you can quickly gauge the scope of changes.
How to Use
- Paste or type your original text into the Original panel on the left.
- Paste or type the modified version into the Modified panel on the right.
- The diff is computed automatically as you type. Review the color-coded output below the input panels.
- Switch between Side by Side, Inline, and Unified view modes using the tabs in the toolbar.
- Check the stats badges to see a summary of added, removed, modified, and unchanged lines.
- Click Copy Diff to copy the unified diff output to your clipboard, or Clear to reset both panels.
- Use Sample to load example text and explore the tool's features.
- Keyboard shortcuts: Ctrl+Enter to compute diff, Ctrl+Shift+C to copy the unified diff output.
FAQ
Is my data safe when using this tool?
Yes. The diff is computed entirely in your browser using JavaScript. No data is sent to any server, stored, or logged. You can safely compare sensitive files like environment variables, private keys, and proprietary code.
What algorithm does the diff viewer use?
The tool uses a Longest Common Subsequence (LCS) algorithm to determine line-level changes between the two inputs. For modified lines, a second character-level LCS pass highlights the exact characters that changed within each line.
What is the difference between the three view modes?
Side by Side shows original and modified text in two columns for easy visual comparison. Inline merges both texts into one column, marking removed and added lines with - and + symbols. Unified outputs a classic unified diff format that you can copy and paste into code reviews or commit messages.
Can I compare large files?
The tool handles files of moderate size well. For very large files (tens of thousands of lines), the LCS computation may take a moment. If performance is a concern, consider comparing smaller sections at a time.
What do the colors mean?
Green highlights lines or characters that were added in the modified text. Red highlights lines or characters that were removed from the original. Yellow indicates lines that exist in both texts but have been modified, with character-level highlights showing exactly what changed.
Can I copy the diff output?
Yes. Click the Copy Diff button to copy the diff in unified format to your clipboard. You can also use the keyboard shortcut Ctrl+Shift+C for quick copying.
Related Tools
JSON Formatter
Format, validate, and beautify JSON with syntax highlighting and tree view.
JSON ↔ YAML Converter
Convert between JSON and YAML formats instantly with syntax validation.
HTML Entity Encode/Decode
Encode and decode HTML entities, named characters, and Unicode escape sequences.
Regex Tester
Test regular expressions with real-time match highlighting and capture groups.