A complete guide to comparing text and files, how the file picker and diff algorithm work, and real-world uses for line-by-line text comparison.
Launch the Text Diff Tool →The Text Diff Tool compares two blocks of text — labeled Text #1 and Text #2 — line by line, and visually highlights exactly what was added, removed, or left unchanged between them. Each line in the result is color-coded and prefixed with a + or - symbol, closely mirroring the familiar visual style of diff output used throughout software version control systems.
Either text box can be filled by pasting content directly, or by clicking its label and selecting a file from your device through your browser's native file picker, which automatically loads that file's contents into the corresponding box and displays its filename underneath as a quick reference, without ever uploading the file anywhere.
Clicking either "Text #1" or "Text #2" label triggers your browser's genuine, built-in file selection dialog — the exact same system file picker you'd see from any other application on your device. Once you select a file, its contents are read directly from your local disk using the browser's FileReader API and loaded into the corresponding text box automatically, with a small status indicator appearing underneath showing the filename you selected.
It's worth being clear about a genuine, unavoidable browser limitation here: for security and privacy reasons, browsers never expose a selected file's full absolute path to JavaScript, only its filename. This means the status indicator can show you selected config-old.txt, but never the full path like C:\Users\you\Documents\config-old.txt — that information is deliberately withheld by every browser from any webpage's JavaScript, regardless of how the page is built, as a basic privacy protection preventing websites from learning details about your local filesystem structure.
The file picker is also, necessarily, your operating system's standard "Open File" dialog rather than any kind of custom search interface, since JavaScript running on a webpage has no ability to browse or search a user's filesystem directly — the only filesystem access any webpage ever gets is through this exact kind of explicit, user-initiated file selection dialog, which is itself a deliberate browser security boundary.
Determining the most useful, minimal set of differences between two blocks of text is a well-studied computer science problem, and this tool implements a standard dynamic programming approach to solve it correctly. The core idea is to build a table recording, for every possible pair of positions within the two texts, the length of the longest common subsequence of lines achievable from that point onward, working backward from the end of both texts to the beginning.
Once that table is fully built, the tool walks forward through it, at each step comparing the current line from Text #1 against the current line from Text #2: if they match, that line is marked unchanged and both positions advance together; if they don't match, the table is consulted to determine whether treating the current line from Text #1 as removed, or the current line from Text #2 as added, leads toward the longest possible common subsequence, and the appropriate choice is made and recorded. This process reliably produces the same kind of clean, minimal diff output that professional version control tools aim for, rather than a naive line-by-line comparison that would incorrectly flag every subsequent line as changed after a single early insertion or deletion threw the alignment off.
Comparing a three-line original text against a version with one new line inserted in the middle correctly identifies only that one new line as "added," with the lines before and after it correctly recognized as unchanged, rather than naively treating every line after the insertion point as different simply because their positions shifted.
The "Ignore leading/trailing whitespace" option trims whitespace from the beginning and end of each line before comparing it, which is particularly useful when comparing configuration files or code where indentation or trailing spaces might differ between two otherwise functionally identical versions, without those purely cosmetic differences being flagged as meaningful changes.
The "Ignore case" option converts each line to lowercase before comparing, useful when the specific capitalization of text doesn't matter for your purposes and you only want to see genuinely substantive differences, such as comparing two drafts of a document where someone may have inconsistently capitalized certain words without changing the actual meaning.
Both options can be toggled on or off after an initial comparison has already run, and the tool automatically re-runs the comparison immediately when either toggle changes, letting you quickly see how much of a reported difference is purely a matter of whitespace or capitalization versus a genuinely substantive change.
Comparing two versions of text content is a recurring need across many kinds of work, and a few common scenarios illustrate why having a fast, no-signup tool for it is genuinely useful:
All comparison happens entirely within your browser using a local, dynamic-programming diff algorithm. No network request of any kind is made by this tool. Files selected through the file picker are read directly into browser memory from your local disk using the FileReader API and are never uploaded anywhere — neither the file content nor the filename itself is ever transmitted, logged, or stored outside your current browser session.
This is a deliberate browser security restriction, not a limitation of this tool specifically. No webpage's JavaScript is ever given access to a selected file's full filesystem path, only its filename, as a basic privacy protection against websites learning details about your local filesystem structure.
Once you manually edit a text box that was previously filled by a selected file, that content is no longer exactly what the file contained, so the filename indicator is automatically cleared to avoid implying the box still reflects the original file's unmodified contents.
This tool is specifically built to compare two individual blocks of text or two individual files at a time. Comparing multiple files or entire folder structures would require a different, more specialized tool.
No, this tool performs line-level comparison: an entire line is marked as added, removed, or unchanged, but it does not further highlight which specific words or characters differ within a line that has changed.