{"id":65077,"date":"2025-08-01T08:03:28","date_gmt":"2025-08-01T05:03:28","guid":{"rendered":"https:\/\/wpcalc.com\/en\/?p=65077"},"modified":"2026-09-30T20:41:06","modified_gmt":"2026-09-30T17:41:06","slug":"multiplicative-inverse-modulo","status":"publish","type":"post","link":"https:\/\/wpcalc.com\/en\/mathematics\/multiplicative-inverse-modulo\/","title":{"rendered":"Multiplicative Inverse Modulo Calculator"},"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\">Find Modular Multiplicative Inverse of a Number<\/h2><\/div><div class=\"calcdash-favorite group\">\n  <button type=\"button\" class=\"favorite\" id=\"favorite\" data-favorite-id=\"65077\" data-favorite-title=\"Multiplicative Inverse Modulo\" data-favorite-url=\"https:\/\/wpcalc.com\/en\/mathematics\/multiplicative-inverse-modulo\/\" data-favorite-excerpt=\"Find the modular multiplicative inverse of a number: enter a value a and a modulus n, and the calculator solves a\u00b7x \u2261 1 (mod n) using the Extended Euclidean Algorithm, with a verification of the result.\" aria-label=\"Add to Favorites\" data-favorite-icon=\"icon icon-arithmetic\">\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\/mathematics\/multiplicative-inverse-modulo\/\" method=\"POST\" class=\"calculator\" id=\"calculator-65077\" data-post=\"65077\"><fieldset class=\"fieldset-input\"><legend class=\"sr-only\">Input Fields<\/legend><div class=\"field has-term\" id=\"input-1\"><label for=\"field-1\">Number (a)<\/label><div class=\"term\">a<\/div>  <div class=\"absolute bottom-0 left-16 top-8 w-2 h-0.5 bg-blue-500\"><\/div><input type=\"text\" name=\"number_a\" id=\"field-1\" aria-describedby=\"calc-info-1\" data-number inputmode=\"decimal\" autocomplete=\"off\" spellcheck=\"false\" min=\"1\" value=\"3\"\/><small id=\"calc-info-1\">Enter the number to find the inverse for<\/small><\/div><div class=\"field has-term\" id=\"input-2\"><label for=\"field-2\">Modulo (n)<\/label><div class=\"term\">n<\/div>  <div class=\"absolute bottom-0 left-16 top-8 w-2 h-0.5 bg-blue-500\"><\/div><input type=\"text\" name=\"modulo_n\" id=\"field-2\" aria-describedby=\"calc-info-2\" data-number inputmode=\"decimal\" autocomplete=\"off\" spellcheck=\"false\" min=\"2\" value=\"11\"\/><small id=\"calc-info-2\">Enter the modulus (must be &gt; 1)<\/small><\/div><\/fieldset><div class=\"buttons\"><button type=\"submit\" data-text=\"Re-Calculate\" id=\"calculate-button\" data-post=\"65077\">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 Results<\/h3><div class=\"result-box\"><div class=\"field-result\" id=\"output-1\"><span class=\"field-title\"><span>Multiplicative Inverse<\/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\" id=\"output-2\"><span class=\"field-title\"><span>Check<\/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><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=\"65077\" 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>Modular Inverse 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\\[ a \\cdot x \\equiv 1 \\pmod{n}, \\qquad a \\cdot x + n \\cdot y = \\gcd(a, n) = 1 \\]\n<\/div>\r\n\t<\/figure>\r\n\t<\/p>\n<p><strong>Where:<\/strong><\/p>\n<ul>\n<li>\\(a\\) \u2014 the number whose inverse you want<\/li>\n<li>\\(x\\) \u2014 the modular multiplicative inverse of \\(a\\)<\/li>\n<li>\\(n\\) \u2014 the modulus (must be greater than 1)<\/li>\n<li>\\(y\\) \u2014 an auxiliary integer from the Extended Euclidean Algorithm<\/li>\n<li>\\(\\gcd(a, n)\\) \u2014 the greatest common divisor of \\(a\\) and \\(n\\)<\/li>\n<\/ul>\n<p>The inverse \\(x\\) exists if and only if \\(\\gcd(a, n) = 1\\), i.e. when \\(a\\) and \\(n\\) are coprime. The Extended Euclidean Algorithm finds coefficients \\(x\\) and \\(y\\) satisfying the second equation, and \\(x\\) taken modulo \\(n\\) is the answer.<\/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>Modular Inverse \u2013 Calculation Example<\/h2><\/div>\r\n\r\n<\/p>\n<p><strong>Example:<\/strong> find the multiplicative inverse of 3 modulo 11 (the calculator's default values).<\/p>\n<p>Apply the Extended Euclidean Algorithm to \\(a = 3\\) and \\(n = 11\\):<\/p>\n<p>\\[ 11 = 3 \\cdot 3 + 2 \\]<br \/>\n\\[ 3 = 1 \\cdot 2 + 1 \\]<\/p>\n<p>Back-substitute:<\/p>\n<p>\\[ 1 = 3 - 2 = 3 - (11 - 3 \\cdot 3) = 4 \\cdot 3 - 1 \\cdot 11 \\]<\/p>\n<p>So \\(3 \\cdot 4 + 11 \\cdot (-1) = 1\\), which means \\(3 \\cdot 4 \\equiv 1 \\pmod{11}\\).<\/p>\n<p><strong>Result:<\/strong> the multiplicative inverse of 3 mod 11 is <strong>4<\/strong>, and the check confirms \\(3 \\times 4 \\equiv 1 \\pmod{11}\\).<\/p>\n<p>\n\r\n<\/section>\n<h2>How to Use the Calculator<\/h2>\n<ol>\n<li>Enter the number \\(a\\) in the <strong>Number (a)<\/strong> field \u2014 the value you want the inverse for.<\/li>\n<li>Enter the modulus in the <strong>Modulo (n)<\/strong> field. It must be greater than 1.<\/li>\n<li>Read the <strong>Multiplicative Inverse<\/strong> result \u2014 the value \\(x\\) with \\(a \\cdot x \\equiv 1 \\pmod{n}\\).<\/li>\n<li>Check the <strong>Check<\/strong> line, which shows the verification \\(a \\times x \\equiv 1 \\bmod n\\).<\/li>\n<\/ol>\n<p>If \\(a\\) and \\(n\\) share a common factor greater than 1, the calculator reports that the inverse does not exist, because no multiple of \\(a\\) can ever be congruent to 1 modulo \\(n\\).<\/p>\n<h2>What Is a Modular Multiplicative Inverse?<\/h2>\n<p>In ordinary arithmetic, the inverse of a number is its reciprocal: the inverse of 3 is \\(1\/3\\), because \\(3 \\cdot 1\/3 = 1\\). Modular arithmetic has no fractions, so the multiplicative inverse is defined differently. The inverse of \\(a\\) modulo \\(n\\) is an integer \\(x\\) such that<\/p>\n<p>\\[ a \\cdot x \\equiv 1 \\pmod{n} \\]<\/p>\n<p>In other words, when you multiply \\(a\\) by \\(x\\) and divide by \\(n\\), the remainder is exactly 1. For example, \\(3 \\times 4 = 12\\), and 12 leaves a remainder of 1 when divided by 11, so 4 is the inverse of 3 modulo 11. Every number coprime with the modulus has exactly one inverse in the range \\(0\\) to \\(n-1\\).<\/p>\n<p>This concept matters because modular \"division\" is really multiplication by the inverse. To solve \\(a \\cdot x \\equiv b \\pmod{n}\\), you multiply both sides by the inverse of \\(a\\) \u2014 the same move as dividing both sides of an ordinary equation, but done in a way that stays within integers.<\/p>\n<p>Modular inverses are also central to cryptography. RSA key generation computes the private exponent as the inverse of the public exponent modulo \\(\\varphi(n)\\); Diffie\u2013Hellman and elliptic-curve schemes rely on inverses in finite fields. Beyond cryptography, inverses appear in error-correcting codes, hashing, and number-theoretic problems solved with tools like the <a href=\"https:\/\/wpcalc.com\/en\/mathematics\/chinese-remainder-theorem\/\">Chinese Remainder Theorem<\/a>.<\/p>\n<h2>When the Inverse Exists (and When It Doesn't)<\/h2>\n<p>An inverse of \\(a\\) modulo \\(n\\) exists <strong>if and only if<\/strong> \\(\\gcd(a, n) = 1\\). Two numbers with a gcd of 1 are called <em>coprime<\/em> or <em>relatively prime<\/em>. The reason is visible in the Extended Euclidean identity: it can only produce \\(a \\cdot x + n \\cdot y = 1\\) when 1 is a combination of \\(a\\) and \\(n\\), which happens precisely when their gcd is 1.<\/p>\n<p>For example, 6 has no inverse modulo 9, because \\(\\gcd(6, 9) = 3\\): every multiple of 6 is divisible by 3, so it can never leave a remainder of 1. But 6 does have an inverse modulo 11, since \\(\\gcd(6, 11) = 1\\).<\/p>\n<p>A useful shortcut: when the modulus \\(n\\) is a <strong>prime<\/strong>, every \\(a\\) from 1 to \\(n-1\\) has an inverse, because no number smaller than a prime shares a factor with it. In that special case the inverse can also be computed with <a href=\"https:\/\/wpcalc.com\/en\/mathematics\/fermats-little-theorem\/\">Fermat's Little Theorem<\/a> as \\(a^{n-2} \\bmod n\\); for composite moduli, <a href=\"https:\/\/wpcalc.com\/en\/mathematics\/eulers-theorem\/\">Euler's Theorem<\/a> gives the analogous result \\(a^{\\varphi(n)-1}\\)<\/p>\n<h2>Limitations and Practical Notes<\/h2>\n<ul>\n<li>The calculator requires \\(n &gt; 1\\); modulo 1 every number is congruent to 0 and an inverse is meaningless.<\/li>\n<li>Enter a positive \\(a\\). If you need the inverse of a negative number, reduce it first: the inverse of \\(-a\\) equals the inverse of \\(n - a\\).<\/li>\n<li>The result is always returned in the range \\(0 \\le x &lt; n\\), which is the standard representative of the solution.<\/li>\n<li>For very large numbers (hundreds of digits, as in real cryptographic work), browser-based computation reaches its limits; this calculator is intended for everyday and educational use.<\/li>\n<li>The Extended Euclidean Algorithm runs in logarithmic time, so even large hand-scale inputs are handled instantly \u2014 there is no need to test candidate values one by one.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Find the modular multiplicative inverse of a number: enter a value a and a modulus n, and the calculator solves a\u00b7x \u2261 1 (mod n) using the Extended Euclidean Algorithm, with a verification of the result.<\/p>\n","protected":false},"author":3168,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[7],"tags":[72],"class_list":["post-65077","post","type-post","status-publish","format-standard","hentry","category-mathematics","tag-arithmetic-calculators"],"acf":[],"_links":{"self":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/65077","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=65077"}],"version-history":[{"count":5,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/65077\/revisions"}],"predecessor-version":[{"id":66266,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/65077\/revisions\/66266"}],"wp:attachment":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/media?parent=65077"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/categories?post=65077"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/tags?post=65077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}