Text Diff
Compare two texts and show differences
Introduce dos textos para comparar las diferencias
Comparador de Texto (Diff)
Compara dos textos línea por línea y muestra las diferencias destacadas. Las líneas verdes (+) son añadidas, las rojas (-) son eliminadas. Útil para revisar cambios en código o documentos.
Online Text Comparison - See the Differences Between Texts
How does text comparison work?
The diff algorithm compares two texts by finding the Longest Common Subsequence and marking everything else as different. Differences fall into three classes: additions, lines present only in the new text; deletions, lines present only in the original; and modifications, lines that changed in part. The visual output uses colour: green for additions, red for deletions and amber for changes inside a line. It is the same principle behind Git, code editors and code review tools.
Comparison modes: line versus character
Comparison can run at line level, where a whole line is either identical or different, or at character level, where you see exactly which characters changed inside each line. Line mode reads better for large changes; character mode is what you want for subtle differences such as extra spaces, capitalisation changes or typos. This tool can highlight inline differences, showing exactly which part of the text changed, much like a unified Git diff.
Use cases for text comparison
Text comparison is useful for reviewing code changes before a commit, verifying that a data migration preserved the content, comparing versions of legal documents or contracts, spotting differences between environment configurations, checking that a find-and-replace did not overreach, comparing output from different versions of a program, reviewing a translation against the original, and detecting copied content. A visual diff tool saves considerable time over reading long documents side by side by hand.
If you work with this tool, you will probably also find these useful Text Diff Checker, Word Counter, String Utilities, Line Sorter.
Frequently asked questions
Why do some lines show as deleted and added rather than modified?
When a line changes substantially, the algorithm may register it as a deletion of the original plus an addition of the new version rather than a modification, because it optimises for the shortest common sequence. Lines with small changes typically show an inline modification; large changes show as a delete plus an add.
How do I ignore whitespace differences?
Turn on the ignore whitespace option so that differences consisting only of spacing, such as extra spaces, tabs versus spaces or trailing whitespace, are not flagged as changes. That is exactly what you want when comparing code formatted in different styles but with identical logic.
Can I compare very large files?
The comparison runs in your browser, and texts of several thousand lines work comfortably. For files with millions of lines, use a command line tool such as diff, delta or difftastic, which are optimised for massive files and can stream the input.
Why does the code diff look different from Git?
Git uses a unified diff with context, showing a few lines around each change. This tool shows every line side by side. Both formats are valid: unified is compact for patches, side by side is more visual for review. The content detected as different is the same either way.