{"id":67631,"date":"2026-11-26T10:08:40","date_gmt":"2026-11-26T07:08:40","guid":{"rendered":"https:\/\/wpcalc.com\/en\/?p=67631"},"modified":"2026-11-26T10:08:40","modified_gmt":"2026-11-26T07:08:40","slug":"diff-checker-compare-text-online","status":"publish","type":"post","link":"https:\/\/wpcalc.com\/en\/web-tools\/diff-checker-compare-text-online\/","title":{"rendered":"Diff Checker \u2013 Compare Text Online"},"content":{"rendered":"<section class=\"not-prose calculator-box\" aria-labelledby=\"calculator-title\"><div class=\"flex items-baseline sm:items-center justify-between gap-2 sm:gap-3\"><div class=\"flex flex-col sm:flex-row sm:items-center gap-2\"><span class=\"icon icon-calculator text-primary-700! text-base! dark:text-primary-300!\" aria-hidden=\"true\"><\/span><h2 id=\"calculator-title\" class=\"text-lg font-display font-bold\">Compare Two Texts and Highlight Every Difference<\/h2><\/div><div class=\"calcdash-favorite group\">\n  <button type=\"button\" class=\"favorite\" id=\"favorite\" data-favorite-id=\"67631\" data-favorite-title=\"Diff Checker\" data-favorite-url=\"https:\/\/wpcalc.com\/en\/web-tools\/diff-checker-compare-text-online\/\" data-favorite-excerpt=\"Paste two texts or load .txt files and instantly see every added, removed and changed line highlighted in green and red. Get line counts, a similarity score and a standard unified diff to copy \u2014 everything runs locally in your browser.\" aria-label=\"Add to Favorites\" data-favorite-icon=\"icon icon-d-edit\">\n    <span class=\"icon icon-shape-star-empty\" aria-hidden=\"true\"><\/span>\n  <\/button>\n  <div class=\"calcdash-favorite__tip\" aria-hidden=\"true\">\n   <span class=\"favorite-tooltip\" id=\"favorite-tooltip\"><\/span>\n  <\/div>\n  <span class=\"sr-only\" role=\"status\" id=\"favorite-status\"><\/span>\n<\/div><\/div><form action=\"https:\/\/wpcalc.com\/en\/web-tools\/diff-checker-compare-text-online\/\" method=\"POST\" class=\"calculator\" id=\"calculator-67631\" data-post=\"67631\"><fieldset class=\"fieldset-input\"><legend class=\"sr-only\">Input Fields<\/legend><div class=\"field is-single\" id=\"input-1\"><label for=\"field-1\">Original text (A)<\/label><textarea id=\"field-1\" name=\"original_text_a\">The quick brown fox jumps over the lazy dog.\nPack my box with five dozen liquor jugs.\n\nThe five boxing wizards jump quickly.\nA journey of a thousand miles begins with a single step.\nActions speak louder than words.<\/textarea><\/div><div class=\"field is-single\" id=\"input-2\"><label for=\"field-2\">Changed text (B)<\/label><textarea id=\"field-2\" name=\"changed_text_b\">The quick brown fox leaps over the lazy dog.\nPack my box with five dozen liquor jugs.\nSphinx of black quartz, judge my vow.\n\nA journey of a thousand miles begins with a single step.\nActions speak louder than words.\nHow vexingly quick daft zebras jump!<\/textarea><\/div><div class=\"is-single field\" id=\"input-3\"><span class=\"font-semibold\">Comparison options<\/span><\/div><div class=\"field\" id=\"input-4\"><label for=\"field-4\">View<\/label><div class=\"grid grid-cols-1\"><select id=\"field-4\" name=\"view\"><option value=\"sbs\" selected>Side by side<\/option><option value=\"uni\">Unified (inline)<\/option><\/select><svg class=\"pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-gray-500 sm:size-4\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\" data-slot=\"icon\">\n              <path fill-rule=\"evenodd\" d=\"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z\" clip-rule=\"evenodd\" \/>\n            <\/svg><\/div><\/div><div class=\"field\" id=\"input-5\"><label for=\"field-5\">Highlight detail<\/label><div class=\"grid grid-cols-1\"><select id=\"field-5\" name=\"highlight_detail\"><option value=\"word\" selected>Per word<\/option><option value=\"char\">Per character<\/option><\/select><svg class=\"pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-gray-500 sm:size-4\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\" data-slot=\"icon\">\n              <path fill-rule=\"evenodd\" d=\"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z\" clip-rule=\"evenodd\" \/>\n            <\/svg><\/div><\/div><div class=\"field is-checkbox\" id=\"input-6\"><input type=\"checkbox\" id=\"field-6\" value=\"1\"\/><label for=\"field-6\">Ignore whitespace<\/label><\/div><div class=\"field is-checkbox\" id=\"input-7\"><input type=\"checkbox\" id=\"field-7\" value=\"1\"\/><label for=\"field-7\">Ignore letter case<\/label><\/div><div class=\"field is-checkbox\" id=\"input-8\"><input type=\"checkbox\" id=\"field-8\" value=\"1\"\/><label for=\"field-8\">Skip blank lines<\/label><\/div><\/fieldset><div class=\"buttons\"><button type=\"submit\" data-text=\"Re-Calculate\" id=\"calculate-button\" data-post=\"67631\">Calculate<\/button><button type=\"reset\">Reset<\/button><\/div><div class=\"field is-checkbox hidden!\" id=\"field-auto-calc\"><input type=\"checkbox\" id=\"auto-calc\"><label for=\"auto-calc\">Calculate automatically<\/label><small>If enabled, the result will update automatically when you change any value.<\/small><\/div><div class=\"fieldset-result is-hidden\" aria-labelledby=\"result-title\" aria-live=\"polite\" role=\"region\"> <h3 class=\"result-title bg-gradient-to-r from-primary-50 to-gray-50 dark:from-primary-900 dark:to-gray-800\" id=\"result-title\"><span class=\"icon icon-s-pulse\" aria-hidden=\"true\"><\/span> Your Comparison<\/h3><div class=\"result-box\"><div class=\"field-result is-column\" id=\"output-1\"><span class=\"field-title\"><span>Summary and actions<\/span><\/span><span class=\"field-value\" id=\"result-1\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><div class=\"field-result is-column\" id=\"output-2\"><span class=\"field-title\"><span>Diff view \u2014 added lines green, removed red, changed words highlighted<\/span><\/span><span class=\"field-value\" id=\"result-2\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><div class=\"field-result is-column\" id=\"output-3\"><span class=\"field-title\"><span>Unified diff to copy (standard diff format)<\/span><\/span><span class=\"field-value\" id=\"result-3\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><div class=\"field-result is-column\" id=\"output-4\"><span class=\"field-title\"><span>How this diff checker works<\/span><\/span><span class=\"field-value\" id=\"result-4\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><\/div><div class=\"result-actions\"><button type=\"button\" class=\"copy-link\"><svg viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M12.232 4.232a2.5 2.5 0 0 1 3.536 3.536l-1.225 1.224a.75.75 0 0 0 1.061 1.06l1.224-1.224a4 4 0 0 0-5.656-5.656l-3 3a4 4 0 0 0 .225 5.865.75.75 0 0 0 .977-1.138 2.5 2.5 0 0 1-.142-3.667l3-3Z\"\/><path d=\"M11.603 7.963a.75.75 0 0 0-.977 1.138 2.5 2.5 0 0 1 .142 3.667l-3 3a2.5 2.5 0 0 1-3.536-3.536l1.225-1.224a.75.75 0 0 0-1.061-1.06l-1.224 1.224a4 4 0 1 0 5.656 5.656l3-3a4 4 0 0 0-.225-5.865Z\"\/><\/svg><span class=\"copy-link__text\">Copy link to this calculation<\/span><\/button><span class=\"sr-only\" role=\"status\" id=\"copy-link-status\"><\/span><\/div><\/div><a href=\"#respond\" class=\"hidden transition-opacity duration-300 opacity-0 w-50 text-sm justify-center items-center gap-2 px-4 py-2 rounded bg-gray-200 text-gray-700 hover:bg-gray-300\" id=\"leave-comment\"><span class=\"icon icon-comments\" aria-hidden=\"true\"><\/span>Leave a Comment<\/a><\/form><\/section><section id=\"calc-reactions\" class=\"not-prose hidden my-12 bg-gradient-to-r from-primary-50 to-gray-50 border border-indigo-100 rounded-xl px-6 py-4 shadow-sm\" data-post=\"67631\" aria-live=\"polite\" aria-labelledby=\"calc-reactions-title\"><p id=\"calc-reactions-title\" class=\"text-sm text-gray-500 text-center mb-2\">How did this result make you feel?<\/p><div role=\"group\" aria-labelledby=\"calc-reactions-title\" class=\"grid grid-cols-3 sm:flex sm:flex-row sm:justify-around gap-4 sm:items-center sm:flex-wrap\"><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"like\"><span class=\"reaction-count\" data-reaction-count=\"like\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude00 <\/span><span class=\"reaction-description font-medium\">Like <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"helpful\"><span class=\"reaction-count\" data-reaction-count=\"helpful\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\udca1 <\/span><span class=\"reaction-description font-medium\">Helpful <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"confused\"><span class=\"reaction-count\" data-reaction-count=\"confused\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude15 <\/span><span class=\"reaction-description font-medium\">Confused <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"disappointed\"><span class=\"reaction-count\" data-reaction-count=\"disappointed\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude1e <\/span><span class=\"reaction-description font-medium\">Disappointed <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"inaccurate\"><span class=\"reaction-count\" data-reaction-count=\"inaccurate\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\u274c <\/span><span class=\"reaction-description font-medium\">Inaccurate <\/span><\/button><\/div><div id=\"reaction-message\" class=\"hidden mt-8 rounded-md border border-primary-100 bg-white\/50 backdrop-blur-sm px-4 py-2 text-sm text-center shadow-sm\"><\/div><\/section><div class=\"calcdash-ad not-prose calcdash-ad--calc_result calcdash-ad--in-article\"><ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-1721569815777345\" data-ad-slot=\"6317458308\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\"><\/ins><script>(adsbygoogle = window.adsbygoogle || []).push({});<\/script><\/div>\n<style id=\"wpcoderpro-inline-1\">.formula-box {\r\n\tborder-bottom: none !important;\r\n}<\/style><section class=\"formula-box\" aria-labelledby=\"formula-title\">\r\n\t<div id=\"formula-title\" class=\"not-prose font-display mb-4\"><span class=\"icon icon-formula\" aria-hidden=\"true\"><\/span><h2>Diff Checker Formula<\/h2><\/div>\r\n\t<figure class=\"not-prose formula\">\r\n\t\t<figcaption class=\"formula-title\">Formula<\/figcaption>\r\n\t\t<div class=\"text-base text-gray-800\" id=\"formula\">\n\\[ \\begin{aligned} D &amp;= N + M - 2L \\\\ S &amp;= \\mathrm{round}\\!\\left(\\frac{200C}{N+M}\\right)\\,\\% \\end{aligned} \\]\n<\/div>\r\n\t<\/figure>\r\n\t<\/p>\n<p><strong>Where:<\/strong><\/p>\n<ul>\n<li>\\(D\\) \u2014 size of the <em>shortest edit script<\/em>: the smallest number of line deletions and insertions that turns text A into text B<\/li>\n<li>\\(N\\), \\(M\\) \u2014 number of compared lines in the original (A) and the changed (B) text<\/li>\n<li>\\(L\\) \u2014 length of the longest common subsequence (LCS) of matching lines shared by both texts<\/li>\n<li>\\(C\\) \u2014 number of line pairs the two texts have in common (unchanged lines)<\/li>\n<li>\\(S\\) \u2014 the similarity percentage shown in the summary badge<\/li>\n<\/ul>\n<p>The calculator finds \\(D\\) with the <strong>Myers O(ND) algorithm<\/strong> \u2014 the same algorithm family that powers <code>git diff<\/code> and GNU <code>diff<\/code>. Its cost grows with the size of the <em>difference<\/em> rather than the size of the files, which is why two long but nearly identical documents compare almost instantly.<\/p>\n<p>\r\n<\/section>\n<style id=\"wpcoderpro-inline-459\">.calculation-box {\r\n\tborder-bottom: none !important;\r\n}<\/style><section id=\"calculation\" class=\"calculation-box\" aria-labelledby=\"calculation-title\">\r\n\t<div id=\"calculation-title\" class=\"not-prose font-display\"><span class=\"icon icon-unordered-list\" aria-hidden=\"true\"><\/span><h2>Diff Checker \u2013 Calculation Example<\/h2><\/div>\r\n\r\n<\/p>\n<p><strong>Example:<\/strong> the two pre-filled texts. Text A contains 5 non-blank lines after the empty line in the middle is skipped (the \"Skip blank lines\" option is on by default); text B contains 6 lines.<\/p>\n<p>The line diff marks three regions of change. The first lines share every word except one, so they are paired and the second pass narrows the difference down to a single word: <em>jumps<\/em> in A becomes <em>leaps<\/em> in B \u2014 one changed line, highlighted on both sides. The third line of A (\"The five boxing wizards\u2026\") shares no words with the third line of B (\"Sphinx of black quartz\u2026\"), so it counts as one removed and one added line rather than one change. The final line of B is brand new \u2014 one more added line.<\/p>\n<p><strong>Result:<\/strong> 2 lines added, 1 line removed, 1 line changed, 3 unchanged.<\/p>\n<p>The similarity badge is \\( \\mathrm{round}\\left(\\frac{200 \\cdot 3}{5+6}\\right) = 55\\% \\), and the \"Copy unified diff\" button produces a standard patch in <code>diff -u<\/code> format covering all three changes.<\/p>\n<p>\n\r\n<\/section>\n<h2>How to use the calculator<\/h2>\n<ol>\n<li>Paste the original version into <strong>Original text (A)<\/strong>, or click <strong>\ud83d\udcc2 Load original .txt<\/strong> to read a file straight from your device.<\/li>\n<li>Paste the edited version into <strong>Changed text (B)<\/strong>, or click <strong>\ud83d\udcc2 Load changed .txt<\/strong>. The comparison refreshes the moment you type.<\/li>\n<li>Pick a <strong>View<\/strong>: <em>Side by side<\/em> shows both versions in parallel columns; <em>Unified (inline)<\/em> lists removed and added lines one after another.<\/li>\n<li>Choose the <strong>Highlight detail<\/strong>: <em>Per word<\/em> marks whole words that differ, <em>Per character<\/em> narrows it down to every single character.<\/li>\n<li>Set the comparison options: <strong>Ignore whitespace<\/strong> (lines equal if they differ only by spaces or tabs), <strong>Ignore letter case<\/strong> (Hello = hello), and <strong>Skip blank lines<\/strong> (empty lines are dropped before comparing).<\/li>\n<li>Read the results: summary badges with added\/removed\/changed\/unchanged counts and a similarity score, the color-coded diff view, and a standard unified diff you can copy. Use <strong>\u21c4 Swap texts<\/strong> to reverse the direction and <strong>\u2715 Clear both<\/strong> to start over.<\/li>\n<\/ol>\n<h2>What a diff checker is and how to read the result<\/h2>\n<p>A diff checker (also called a text comparison or merge tool) finds the smallest set of edits that turns one text into another. Instead of reading two versions line by line yourself, you paste both and the tool marks exactly what was added, deleted or modified. It is the standard way to review edits to contracts, essays, code, configuration files, translations or any text that exists in more than one version.<\/p>\n<p>The color code follows the convention used by git and every code editor: <strong>green means added<\/strong> (the line exists only in the changed text), <strong>red means removed<\/strong> (the line exists only in the original), and a red-green pair on the same row is the <em>same line before and after editing<\/em> \u2014 with the exact differing words or characters highlighted inside. Two texts with no differences at all produce a green \"identical\" message instead.<\/p>\n<p>The summary badges give you the scale of the change at a glance: how many lines were added, removed, changed and left untouched, plus a similarity percentage. A 98&nbsp;% similarity means the two versions share 98&nbsp;% of their line pairs (counted across both texts, so 100&nbsp;% requires both texts to be equal). This is handy for quick questions like \"how much did this document actually change between drafts?\" without inspecting every highlight.<\/p>\n<p>The unified diff block is the plain-text standard format that <code>diff -u<\/code> and <code>git diff<\/code> print: <code>@@ -start,count +start,count @@<\/code> heads each hunk, lines starting with <code>-<\/code> come from the original and lines starting with <code>+<\/code> from the changed text. Save the copied output as a <code>.patch<\/code> file and tools like <code>patch<\/code> or <code>git apply<\/code> can apply the changes to a file automatically.<\/p>\n<h2>Assumptions, limits and practical tips<\/h2>\n<ul>\n<li><strong>Comparison is line-based.<\/strong> The tool works on whole lines, then highlights words or characters inside matched line pairs. Reformatting a paragraph into different line lengths will show many changed lines even if the wording is identical.<\/li>\n<li><strong>The ignore options change equality, not your text.<\/strong> \"Ignore whitespace\" collapses runs of spaces and tabs and trims line edges before comparing; \"Skip blank lines\" also changes the line numbers, which then count only the non-blank lines that were actually compared.<\/li>\n<li><strong>Folded context is a display feature.<\/strong> Runs of more than 8 identical lines are folded behind a \"\u22ef N identical line(s) folded \u22ef\" counter with 3 context lines on each side. The summary and the copied unified diff always count and contain every line.<\/li>\n<li><strong>Size limits.<\/strong> The comparison handles up to 30,000 lines combined (about 15,000 per side) and roughly 1.2 million characters total; fully rewritten regions larger than a few thousand lines are compared as whole blocks to keep the page responsive.<\/li>\n<li><strong>Everything stays private.<\/strong> Both textareas and both .txt buttons run entirely in your browser via the standard FileReader interface \u2014 no text or file is ever uploaded to a server.<\/li>\n<li>Useful companions: <a href=\"https:\/\/wpcalc.com\/en\/web-tools\/duplicate-lines-remover\/\">Duplicate Lines Remover<\/a> to clean up lists before comparing them, <a href=\"https:\/\/wpcalc.com\/en\/web-tools\/character-counter\/\">Character Counter<\/a> to check text length across versions, and <a href=\"https:\/\/wpcalc.com\/en\/web-tools\/json-formatter-validator\/\">JSON Formatter<\/a> to pretty-print JSON files so line-based diffing works well. For prose, the <a href=\"https:\/\/wpcalc.com\/en\/web-tools\/case-converter\/\">Case Converter<\/a> fixes inconsistent capitalization before you compare.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Paste two texts or load .txt files and instantly see every added, removed and changed line highlighted in green and red. Get line counts, a similarity score and a standard unified diff to copy \u2014 everything runs locally in your browser.<\/p>\n","protected":false},"author":3168,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[63],"tags":[65],"class_list":["post-67631","post","type-post","status-publish","format-standard","hentry","category-web-tools","tag-text-tools"],"acf":[],"_links":{"self":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/67631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/users\/3168"}],"replies":[{"embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/comments?post=67631"}],"version-history":[{"count":1,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/67631\/revisions"}],"predecessor-version":[{"id":67632,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/67631\/revisions\/67632"}],"wp:attachment":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/media?parent=67631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/categories?post=67631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/tags?post=67631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}