Free Online Diff Tool
Compare two texts with side-by-side or unified diff view. Generate patch-compatible unified diff output.
edit Original
edit Modified
Paste text in both boxes and click Compare to see differences
Key Features
Unified & Split Views
View diffs in unified format (like git diff) or side-by-side with line numbers.
Context Lines Control
Adjust how many unchanged lines appear around each change for better readability.
Patch-Compatible Output
Copy results in standard unified diff format compatible with the patch command.
Privacy First
All processing happens locally in your browser. No data ever leaves your device.
Frequently Asked Questions
Usage
Can I apply the diff output as a patch using the patch command?
Yes, the unified diff output follows standard patch format conventions. Save the output to a .patch or .diff file using Copy, then apply it with
patch original.txt < changes.patch on Unix/Linux or patch.exe on Windows (available via Git Bash, Cygwin, or WSL). The patch tool needs the exact original file to match.How is the Diff Tool different from the Text Diff Checker?
The Diff Tool focuses on line-level diff with configurable context lines, producing output in standard unified diff (patch) format with +/- markers. The Text Diff Checker offers line, word, and character-level granularity with inline highlighting. Use the Diff Tool when you need a patch-compatible output file; use Text Diff Checker for detailed visual comparison with word-level highlighting.
Why does the diff show unchanged lines around each change?
Context lines help you locate where each change occurs within the file. By default, 3 lines of unchanged content appear before and after each hunk (group of changes). This matches git diff behavior. You can adjust the number of context lines (0-20) using the control above. Setting it to 0 shows only the changed lines.
Can I diff binary files?
No. The Diff Tool works with plain text only. Binary content (images, executables, compressed files) cannot be meaningfully compared line by line. Attempting to paste binary data will produce garbled output or Unicode replacement characters. For binary file comparison, use a hex diff tool or the built-in diff commands that ship with version control systems.
Does the tool handle LF vs CRLF line ending differences?
The Diff Tool splits text by any line break (LF, CRLF, or CR), normalizing them internally for comparison. This means a file with Windows CRLF endings compared against the same file with Unix LF endings will show no differences in content. If you need to see line ending differences explicitly, pre-process the text to replace \r\n with visible markers before pasting it into the input.