Diff / Text Compare Tool
Compare two blocks of text side-by-side with line and character-level diffs. Highlights additions, deletions, and changes with presets for .env, composer.json, and docker-compose.yml.
Input exceeds 50,000 characters - falling back to line-level diff to avoid browser slowdown.
| Original | Changed |
|---|---|
How to use the Diff / Text Compare tool
Paste your original text in the left pane and the changed version on the right - the diff updates as you type. Switch between split (side-by-side) and unified view. Use line-level mode for files like .env, composer.json, or docker-compose.yml. Enable character-level diff for pinpointing small inline changes. Load a preset to see an example diff immediately.
Colour guide
Green highlights mark additions - lines or characters present in the changed version but not the original. Red highlights mark removals - content that existed in the original but was deleted. Unchanged lines are shown without a background colour.
Diff in PHP and Laravel
PHP's built-in similar_text() returns a similarity percentage but does not show a structured diff. For structured diffs in PHP, use the sebastian/diff package (also bundled with PHPUnit). The SebastianBergmann\Diff\Differ class produces unified diff output suitable for logging or displaying model change history. For Git-style diffs in the browser this tool uses the diff npm package.