Text Diff
Compare two blocks of text with line-by-line and word-level highlighting.
Frequently Asked Questions
Is the text diff tool free?
Yes, completely free with no account or signup required.
Is my text safe?
All processing is local in your browser. Your text is never uploaded to any server.
What diff features are included?
Unified diff, side-by-side diff, word-level highlighting, line count stats, and a swap button.
What is a text diff?
A diff compares two pieces of text line by line and highlights which lines were added, removed, or unchanged. It is the same algorithm used by Git and code review tools.
What is the difference between unified and side-by-side diff?
Unified diff shows both versions in a single pane with + and - prefixes. Side-by-side shows the original on the left and the modified text on the right, making changes easier to scan visually.
What is word-level diff?
Word-level diff highlights the specific words that changed within a modified line, rather than marking the entire line as changed. Enable it with the Word diff toggle.
How do I compare two code files online?
Paste the original code into the left panel and the modified code into the right panel. Switch to Side-by-side view for an easier code review experience.
What algorithm does the diff tool use?
The tool uses the Myers diff algorithm, the same algorithm used by Git. It finds the shortest edit script — the minimum number of additions and deletions to transform one text into the other.
Can I use this to find merge conflicts?
Yes. Paste the two conflicting versions of a file and the diff will clearly show which lines differ, helping you resolve the conflict manually.
How do I diff JSON or XML?
Paste your JSON or XML into both panels. For cleaner diffs, format both sides first using the JSON or XML formatter on this site before comparing.
How are added and removed lines counted?
The stats bar shows the number of added lines (green), removed lines (red), and unchanged lines. Only real content lines are counted — blank lines are included if present.