Compare two code snippets side by side with character level highlighting. Spot refactors, renames, and logic changes in JavaScript and more.
Enter text in both fields to see the diff
The sample loads a classic refactor: a function declaration rewritten as an arrow function. The diff shows exactly which tokens moved so reviewers confirm nothing else changed.
// original
function add(a, b) {
return a + b;
}
// modified
const add = (a, b) => a + b;
Removed tokens highlight on the left (function keyword, braces, return statement) and added tokens on the right (const, equals, arrow). Unchanged identifiers a and b stay neutral. If a rename slipped in, it would appear as a removed plus added pair on the same line.
Arrow form is shorter and lexically binds this, which suits callbacks and module scope utilities. Function declarations hoist, so they can be called before their definition line. The diff proves the logic line a + b survived untouched while only the wrapper changed.
For JSON payloads use Compare JSON Objects, or normalize style first with the Code Formatter.
Nothing you paste leaves this tab. Every tool runs entirely in your browser — no upload, no server, no account.