This page compares two blocks of code and marks what changed between them. Paste the old version on the left and the new one on the right, and it produces a line table with additions, removals and unchanged context, plus counts for each and a similarity score. Three comparison options control whether trailing whitespace, all whitespace or letter case count as differences.
The comparison is a line diff. It is built for reviewing a function, a config file or a patch-sized edit in the browser, not for walking a repository history. It never sends the code anywhere, and the two text areas are the only inputs.
How the line comparison works
The tool splits both versions at line endings and compares the resulting lines with a longest common subsequence algorithm. Lines that appear in both versions, in the same relative order, are kept as context. The lines between them are marked as removed from version A or added in version B. That is why the output stays readable when a block moves: the algorithm keeps the shared lines and surrounds them with the changed ones.
It is not a character-level diff. Change one character in a line and the whole line is removed and re-added. A word-level view would show the single change, but this page deliberately keeps the unit at the line so the table stays close to what a patch looks like.
All removals are printed before the matching additions in each changed block. The table numbers both sides independently, so a removed line can have an A number and no B number, and the reverse for an addition.
The three comparison options
Ignore trailing whitespace is on by default. It strips spaces and tabs at the end of each line before comparing, so an editor that added a trailing space does not create a false change. Ignore all whitespace removes every space and tab inside the line as well, which is useful when one version was re-indented. Ignore case lowercases both sides before comparison.
The options change what counts as equal, not what is displayed. The table still shows the original text from each version. Two versions that differ only in case produce a similarity of 100% with the case option on, while the same pair produces additions and removals with it off. Turn every option off when you need the raw comparison.
A worked example
Version A was a five-line function with one console.log call. Version B added a parameter, changed both lines that used it and added a second log call. The page reported 4 lines added, 3 removed, 2 unchanged and a similarity of 36.4%.
| Measure | Value |
|---|---|
| Lines in A | 5 |
| Lines in B | 6 |
| Unchanged | 2 |
| Added | 4 |
| Removed | 3 |
| Similarity | 36.4% |
The score is not the percentage of characters that survived. It is twice the number of unchanged lines divided by the total number of lines in both versions: 2 × 2 ÷ 11, rounded to one decimal place. A short file with one changed line therefore scores lower than a long file with the same one-line change, because the shared context is a smaller share of the whole.
The same text with the case option on scored 100%, and with all whitespace ignored it also scored 100% for a pair that differed only in spacing. Neither result means the files are identical on disk; it means they are identical under the selected rules.
Reading the table
Each row carries the A line number, the B line number, a change marker and the line itself. Removed lines show their A number, added lines show their B number, and unchanged lines show both. The marker column uses a minus for a removal and a plus for an addition. The copy button produces a unified-style list with those same prefixes, which is convenient for a commit message or a review note.
Long lines are not wrapped in the copy output. If you are comparing minified code, expect a table of very wide rows; reformat both sides with the JavaScript beautifier or the CSS beautifier before comparing them. That gives the diff real line structure to work with.
Limits and empty states
Each side is limited to 600 lines. Above that the page stops and explains the limit instead of attempting a comparison that could freeze the tab. The warning names both line counts and the limit, so you can see how far over the input is. For a whole repository, use a dedicated diff tool or git diff.
With both sides empty the result area asks for two versions rather than reporting a 0% match. With one side empty, every line on the other side is treated as an addition or a removal. A file that ends with a newline has a final empty line, which can appear as a difference even when the visible text looks the same.
There is no three-way merge, no syntax highlighting by language and no ignore-blank-lines option. Blank lines are compared like any other line, so a version that only removed blank lines will show a series of removals. Use the whitespace options for indentation, not for blank-line noise.