Comparer du texte
Diff Checker is a high-speed, client-side textual comparison engine executing the Myers difference algorithm directly in your browser. It supports line, word, and character granularity, unified and side-by-side views, whitespace and case normalization toggles, and instant unified diff patch generation with zero external network transmission.
L’interface de cet outil est en anglais.
Le guide ci-dessous n’est disponible qu’en anglais.
How does Diff Checker work?
The ToolsByUs text diff engine is based on Eugene W. Myers' seminal paper "An O(ND) Difference Algorithm and Its Variations". The algorithm models the problem of computing the shortest edit script (SES) as finding a shortest path in an edit graph spanning from coordinates (0, 0) to (N, M).
By tracking the furthest reaching paths along diagonals k = x - y for each edit distance D, Myers diff discovers the minimum number of insertions and deletions necessary to transform the original text into the target text. When applied at the word level, the engine performs a secondary diff on modified lines to precisely isolate word-level deletions and insertions.
Unlike server-side tools that transmit your source files, proprietary configs, or confidential logs to a remote database, ToolsByUs runs the entire Myers edit matrix directly in local browser memory.
Original vs Modified Sample
// Original: const port = 8080; // Modified: const port = 3000;
Example output
// Unified Diff: @@ -1,1 +1,1 @@ -const port = 8080; +const port = 3000;
What does a unified diff of two config files look like?
Two versions of the same service block. The patch below is what the tool produces from them — the same format git apply and the UNIX patch command read.
Before
server: host: localhost port: 8080 timeout: 30
After
server: host: 0.0.0.0 port: 8080 timeout: 60 retries: 3
Unified patch
--- a/original +++ b/modified @@ -1,4 +1,5 @@ server: - host: localhost + host: 0.0.0.0 port: 8080 - timeout: 30 + timeout: 60 + retries: 3
The @@ header counts lines, not changes: four lines became five. Unchanged lines are kept as context so the patch still applies after the file moves around them.
What options and edge cases does Diff Checker support?
| Parameter | Type | Default | Behaviour & edge cases |
|---|---|---|---|
| Granularity: line | Mode | Default | Splits text on newline boundaries. Fast O(ND) execution ideal for code, config, and scripts. |
| Granularity: word | Mode | Optional | Splits lines into word tokens. Modified lines highlight word-level insertions and deletions. |
| Granularity: char | Mode | Optional | Splits strings into individual character units. Pinpoints typos, hashes, and base64 strings. |
| Ignore Whitespace | Toggle | false | Normalizes consecutive spaces and tabs so indentation adjustments do not trigger changes. |
| Ignore Case | Toggle | false | Compares text case-insensitively, useful for SQL queries, HTTP headers, or HTML tags. |
| Unified Diff Export | Format | Standard | Exports standard unified diff format compatible with git apply, patch(1), and review tools. |
Frequently asked questions
How does the Myers diff algorithm work?
The Myers diff algorithm finds the shortest sequence of additions and deletions to convert sequence A into sequence B. It operates by exploring diagonal paths across an edit grid, guaranteeing mathematical minimality of the resulting diff output.
Can I export a unified diff patch file?
Yes. Clicking 'Export Unified Patch' produces a standard unified patch document with '---' and '+++' headers and '@@ -start,len +start,len @@' hunk ranges that can be copied or fed directly to standard UNIX patch or git apply utilities.
How does word-level diffing help code reviews?
Standard line diffs highlight the entire line even if only a single character or variable name changed. Our word-level diff engine compares modified lines token by token, highlighting only the specific tokens that were altered within that line.
Are my documents saved or cached on any server?
No. ToolsByUs has no backend server or database. All diff calculations run strictly inside your browser. No files, logs, or text are ever uploaded.
What is the difference between line, word and character diffing?
A line diff marks the whole line changed the moment one character in it differs, which is right for prose and wrong for a line of code where a single variable was renamed. Word mode compares the tokens inside each changed line; character mode goes down to individual letters, which is what finds a swapped character in an identifier or a stray space in a config value.
Can I compare confidential code from a private repository here?
Yes, and you can check rather than trust. The comparison runs in this tab; open DevTools, switch to the Network panel, paste and compare, and no request carrying your text appears. The page is served with a Content-Security-Policy of connect-src 'self', so the browser itself would refuse an outbound request. Once the page has loaded it also works with the network disconnected entirely.