Diff Checker
Compare two versions of any text or code line by line. Removed lines are marked in red, added lines in green, with line numbers and counts. Everything runs in your browser.
Compare two versions of any text or code line by line. Removed lines are marked in red, added lines in green, with line numbers and counts. Everything runs in your browser.
Two versions of a config file, a contract clause that came back from review, a function before and after a refactor, two exports of the same list: when you need to know exactly which lines differ, reading both side by side is slow and error-prone. This checker lines up the Original Text and the Modified Text, marks every line that was removed or added, and counts what stayed the same. It works with any plain text, including source code, CSV rows, log output and prose.
- or + marker and the line itself. Removed lines are red, added lines green, unchanged lines plain.+ , - or two spaces in front of each line. Swap exchanges the two boxes, Sample loads a small JavaScript example, and Clear resets everything.Both texts are split at line breaks, and the page computes the longest common subsequence (LCS) of the two line lists with the classic dynamic-programming table. Lines in that common subsequence are reported as unchanged; everything else in the original is reported as removed and everything else in the modified text as added. Within each gap between matching lines, removals are listed before additions. The result uses the fewest possible added and removed lines, the same goal as git diff, although Git uses a different algorithm (Myers) and can occasionally align equal-sized changes differently.
Lines must match exactly to count as unchanged. That has a few practical consequences:
No. The comparison is JavaScript running on this page; neither text is sent to a server or saved in your browser. It is fine to compare confidential drafts, although, as always, avoid pasting passwords or keys.
The LCS table has one cell for every pair of lines, so memory grows with the product of the two line counts. A few thousand lines per side compares quickly; tens of thousands of lines on both sides can make the tab slow or run out of memory. For very large files, use a desktop diff tool or git diff --no-index.
No. Copy Diff produces a simple marked list without the @@ hunk headers that patch or git apply expect, so it is meant for reading and sharing, not for applying changes.
They usually differ in invisible characters: trailing spaces, tabs versus spaces, a non-breaking space, or a carriage return from Windows line endings. Normalising whitespace in your editor before pasting removes these false differences.