{
  "id": "iban",
  "version": "b9704e5567c5",
  "status": "published",
  "name": "IBAN Calculator",
  "question": "Is this IBAN valid?",
  "summary": "Checks an IBAN: the country code, the length for that country, and the two MOD 97 check digits. Or works out the check digits and the full IBAN from a country code and a domestic account number.",
  "category": "finance",
  "subcategory": "business",
  "url": "https://www.acalculator.org/finance/iban-calculator",
  "markdown": "https://www.acalculator.org/finance/iban-calculator.md",
  "kind": "function",
  "method": "Check: the country code must use IBANs and the length must match the country; move the first four characters to the end, turn letters into numbers (A = 10 … Z = 35), and the whole number mod 97 must be 1. Make: check digits = 98 − (BBAN + country code + 00, letters as numbers) mod 97.",
  "assumptions": [
    "The page checks the country, the length and the check digits. It does not check each country’s own account format or whether the account exists.",
    "Everything runs in your browser. The IBAN is not sent anywhere, but it is in the page link, so share links with care."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "do": {
        "title": "I want to",
        "description": "Check a full IBAN, or make the check digits from a country code and a domestic account number.",
        "type": "string",
        "enum": [
          "check",
          "make"
        ]
      },
      "iban": {
        "title": "IBAN",
        "description": "The full IBAN: two letters, two check digits, then the domestic account number. Spaces are ignored.",
        "type": "string",
        "maxLength": 50
      },
      "cc": {
        "title": "Country code",
        "description": "The two-letter ISO country code, such as DE or GB.",
        "type": "string",
        "maxLength": 2
      },
      "bban": {
        "title": "Domestic account number (BBAN)",
        "description": "The bank and account part of the IBAN, as the bank gives it (for the UK: bank code, sort code, account number).",
        "type": "string",
        "maxLength": 30
      }
    }
  },
  "outputs": {
    "result": {
      "label": "Answer",
      "description": "Whether the IBAN is valid and why not, or the IBAN made with its check digits.",
      "format": "text"
    },
    "valid": {
      "label": "Valid",
      "description": "Yes when the country, length and check digits all pass.",
      "format": "text"
    },
    "checkDigits": {
      "label": "Right check digits",
      "description": "The two check digits this country code and account number need: 98 − (BBAN + country + 00) mod 97.",
      "format": "text"
    },
    "printed": {
      "label": "Print form",
      "description": "The IBAN in groups of four characters.",
      "format": "text"
    },
    "electronic": {
      "label": "Electronic form",
      "description": "The IBAN with no spaces, in capitals.",
      "format": "text"
    },
    "length": {
      "label": "Length for this country",
      "description": "How many characters an IBAN from this country has.",
      "format": "integer"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "do": "check",
      "iban": "GB82 WEST 1234 5698 7654 32",
      "cc": "GB",
      "bban": "WEST12345698765432"
    },
    "outputs": {
      "result": "Valid",
      "valid": "Yes",
      "checkDigits": "82",
      "printed": "GB82 WEST 1234 5698 7654 32",
      "electronic": "GB82WEST12345698765432",
      "length": 22
    },
    "text": "Valid."
  },
  "examples": [
    {
      "given": {
        "do": "check",
        "iban": "GB82 WEST 1234 5698 7654 32"
      },
      "expect": {
        "result": "Valid",
        "valid": "Yes",
        "checkDigits": "82",
        "length": 22,
        "electronic": "GB82WEST12345698765432"
      },
      "source": "Wikipedia, \"International Bank Account Number\" (validation and check digit generation; example GB82 WEST 1234 5698 7654 32), https://en.wikipedia.org/wiki/International_Bank_Account_Number (retrieved 2026-10-05); hand calculation in content.mdx: 3214282912345698765432161182 mod 97 = 1"
    },
    {
      "given": {
        "do": "check",
        "iban": "ie64ircE92050112345678"
      },
      "expect": {
        "result": "Valid",
        "printed": "IE64 IRCE 9205 0112 3456 78"
      },
      "source": "Wikipedia, \"International Bank Account Number\" (validation and check digit generation; example GB82 WEST 1234 5698 7654 32), https://en.wikipedia.org/wiki/International_Bank_Account_Number (retrieved 2026-10-05) (example IE64 IRCE 9205 0112 3456 78); Python 3 cross-check in docs/progress/WP-114/xcheck.py"
    },
    {
      "given": {
        "do": "check",
        "iban": "GB82WEST12345698765433"
      },
      "expect": {
        "result": "Not valid: the check digits should be 55",
        "valid": "No",
        "checkDigits": "55"
      },
      "source": "Wikipedia, \"International Bank Account Number\" (validation and check digit generation; example GB82 WEST 1234 5698 7654 32), https://en.wikipedia.org/wiki/International_Bank_Account_Number (retrieved 2026-10-05) (generation: 98 − remainder); hand calculation in content.mdx: the remainder is 28, not 1; 98 − 43 = 55"
    },
    {
      "given": {
        "do": "make",
        "cc": "GB",
        "bban": "WEST12345698765432"
      },
      "expect": {
        "result": "GB82 WEST 1234 5698 7654 32",
        "checkDigits": "82"
      },
      "source": "Wikipedia, \"International Bank Account Number\" (validation and check digit generation; example GB82 WEST 1234 5698 7654 32), https://en.wikipedia.org/wiki/International_Bank_Account_Number (retrieved 2026-10-05); hand calculation in content.mdx: 3214282912345698765432161100 mod 97 = 16, 98 − 16 = 82"
    },
    {
      "given": {
        "do": "check",
        "iban": "GB82WEST1234569876543"
      },
      "expect": {
        "result": "Not valid: a GB IBAN has 22 characters, this one has 21",
        "valid": "No"
      },
      "source": "Wikipedia, \"International Bank Account Number\" (validation and check digit generation; example GB82 WEST 1234 5698 7654 32), https://en.wikipedia.org/wiki/International_Bank_Account_Number (retrieved 2026-10-05) (United Kingdom: 22 characters)"
    }
  ],
  "sources": [
    "ISO 13616 and ISO 7064 MOD 97-10 as written out in Wikipedia, \"International Bank Account Number\": the country lengths table, validation, check digit generation, and the examples GB82 WEST 1234 5698 7654 32 and IE64 IRCE 9205 0112 3456 78. https://en.wikipedia.org/wiki/International_Bank_Account_Number (retrieved 2026-10-05)",
    "SWIFT, IBAN registry (the source of the country lengths). https://www.swift.com/standards/data-standards/iban-international-bank-account-number (retrieved 2026-10-05)"
  ],
  "related": [
    "check-digit"
  ],
  "changelog": []
}
