IBAN validation guide

IBAN Validation: How to Check an IBAN Safely

IBAN validation is a layered check of a bank-issued string: country format, expected length, allowed characters, and the MOD-97 check-digit relationship. A clear process helps you find copying errors without confusing a format pass with proof of an account.

This guide explains how to validate an IBAN step by step, read common failures, and decide when you need the bank or payment provider. It is useful for payment operations, support teams, QA fixtures, and developers who need a reliable boundary between syntax and account verification.

Editorial illustration of IBAN validation separating country format, length, and MOD-97 checks
IBAN validation tests a structured character sequence; it is not a public account lookup.

What IBAN validation means

IBAN validation checks whether an International Bank Account Number is internally consistent with a registered country format. In practical terms, it asks whether the supplied text has a plausible country code, the right length, permitted characters, and check digits that satisfy the international MOD-97 rule. The result is useful because one missing character, swapped digit, or wrong country prefix can make a payment form reject the value before a bank ever processes it.

The word validation can describe several levels of work, so keep the levels separate. A lightweight format check is not the same as a bank lookup, beneficiary-name match, sanctions screen, or confirmation that a transfer will settle. When you document a result, say exactly what passed: for example, “country format and checksum passed” is more honest than “this is a valid account.” If you need the immediate input workflow, use the IBAN Checker; this page explains how to interpret that workflow and its limits.

Use the bank-issued value as the source. Do not construct a personal IBAN from a name, card number, local account number, or a public example. A generator or example page can create synthetic data for development, but it cannot discover a private account. This boundary protects real payment work and keeps QA data from leaking into production instructions.

LayerQuestion it answersWhat it does not establish
SyntaxAre the prefix and characters shaped like an IBAN?That the string came from a bank.
Country formatDoes the country use this length and BBAN pattern?That every national field is active.
MOD-97Do the check digits match the rest of the string?That an account exists or belongs to a beneficiary.
Authorized verificationCan a bank or provider confirm the account relationship?That a payment is guaranteed under every route and condition.

The validation layers: country, length, BBAN, and MOD-97

Start with the country code. The first two letters select a national IBAN specification, and the following two digits are the international check digits. Everything after those four characters is the country-specific Basic Bank Account Number, or BBAN. A German, French, UK, or Dutch BBAN can use different field positions, characters, and total lengths. A checker must therefore select the country rule before it decides whether the rest of the value looks plausible.

Next compare the normalized value with the registered length. Remove only presentation spaces, preserve leading zeroes, and reject punctuation or hidden characters that the input contract does not allow. A length pass is necessary but weak on its own: many wrong strings can have the right number of characters. The BBAN pattern adds another layer by checking whether a country expects digits, letters, bank fields, branch fields, or a national control field in each position.

Finally, run the MOD-97 calculation. Move the first four characters to the end, expand letters A through Z into their decimal values from 10 through 35, and process the resulting digits with a running remainder. A complete IBAN normally passes when the final remainder is 1. The checksum is powerful for catching transcription errors, but it is still a mathematical relation over text.

Four-step editorial diagram for IBAN validation: normalize, check country format, calculate MOD-97, and confirm the source
Run structural checks in order, then keep bank confirmation as a separate result.
  1. Select the country ruleRead the two-letter prefix and load the current registered length and BBAN pattern.
  2. Normalize presentationRemove display spaces, uppercase letters where permitted, and reject unsupported punctuation.
  3. Check the checksumRotate, expand letters, and calculate the running remainder modulo 97.
  4. Record the boundaryLabel the result as format or checksum validation unless an authorized bank check also passed.

How to validate an IBAN step by step

First obtain the complete value from a bank statement, authenticated banking session, official app, or verified payment instruction. Keep the original presentation so you can compare it again if a check fails. If the value arrived in a message that changes payment details, confirm it through a second trusted channel before sending money. Validation cannot detect every form of payment fraud because a fraudster can provide a perfectly formatted account number.

Second normalize the input according to the tool or provider contract. Printed spaces are usually separators, not data, so a compact electronic field may remove them. Do not silently repair missing characters, replace a letter with a similar-looking digit, or trim leading zeroes. Reject an “IBAN” label, slash, dash, or non-ASCII character unless the documented parser explicitly accepts it.

Third validate in layers and keep the first meaningful failure. If the country is unsupported, do not report a checksum failure as the main problem. If the length is wrong, ask the user to re-copy the value before debugging the checksum. If the checksum fails after the format passes, compare characters from the source and check whether a print-space or line break was copied as data. This sequence turns a vague “invalid IBAN” message into an actionable correction.

  1. 1. Confirm the sourceUse a current bank-issued or authenticated source and verify the account name and currency.
  2. 2. Normalize safelyRemove presentation spaces only, preserve every letter and digit, and reject unexpected symbols.
  3. 3. Apply country rulesCompare the country code, total length, character classes, and broad BBAN positions.
  4. 4. Run MOD-97Use the complete normalized string and expect a final remainder of 1 for checksum consistency.
  5. 5. Escalate correctlyAsk the bank or provider to verify the account when the payment decision needs more than syntax.

How to read pass and fail results

A good validator returns a reasoned status rather than one green badge. “Unsupported country” means the registry or tool does not know the prefix; it is not permission to substitute another country. “Wrong length” means the normalized character count does not match the selected specification. “Invalid characters” often points to punctuation, a copied label, a non-breaking space, or a character outside the permitted alphabet. These failures should be fixed at the source, not patched by guessing.

A checksum mismatch means the rotated and expanded character stream did not leave the expected remainder. Re-copy the value, compare the first four characters, and check for one transposed digit or letter. A checksum pass means the check-digit relationship is mathematically consistent. It does not mean the bank account is open, the beneficiary name matches, or the receiving bank will accept the payment. A reliable interface should show those limits next to the pass state.

  • Never change digits until a checksum passes; a forced pass destroys the evidence of the original error.
  • Keep country-format failure and checksum failure as distinct analytics events.
  • Show a neutral “format accepted” status instead of claiming that a bank confirmed the account.
ResultLikely meaningNext action
Unsupported countryThe prefix is not in the maintained registry or is mistyped.Confirm the bank-issued prefix and registry coverage.
Wrong lengthThe normalized count differs from the national rule.Re-copy the complete value; do not add zeroes.
Pattern failureA character or field does not match the country BBAN rule.Compare the source and country-specific instructions.
Checksum mismatchThe MOD-97 relationship fails after normalization.Check transcription, spacing, and the four-character rotation.
Format passThe string is internally consistent under the tested rules.Use bank/provider verification for account-level decisions.

What IBAN validation cannot prove

A format validator can test a string without contacting a bank. It can usually detect unsupported characters, an incorrect length, a country/BBAN mismatch, and a failed MOD-97 checksum. That is valuable for forms and data cleaning, but it is a narrow technical answer. A string may pass every local rule while remaining unassigned, closed, mistyped in a different field, or unsuitable for the intended payment rail.

Validation also does not establish who owns the account. It cannot infer a person's IBAN from their name, card number, address, or partial local account number. It does not perform beneficiary-name matching, sanctions screening, balance checks, or payment authorization. Those decisions belong to a bank or an authorized provider with the required access and legal controls.

When a real transfer matters, compare the complete IBAN with the recipient's current bank instructions and confirm a changed payment request through a trusted channel. When software is being tested, use clearly labeled synthetic values and environment guards. The test IBAN data guide explains how to keep fixtures out of invoices, beneficiary lists, direct-debit files, and production payment calls.

  • Format validity is not account existence.
  • A country prefix is not proof of the account holder's location.
  • A checksum pass is not proof of ownership or beneficiary matching.
  • A local browser check is not a payment authorization or settlement guarantee.

Developer and QA checklist for IBAN number validation

Implement validation as explicit stages so callers can choose the right response. Keep the source value as text, normalize only the presentation characters your contract allows, and load country rules from a maintained registry. Do not convert a complete IBAN into a JavaScript Number or another floating-point type: long values and leading zeroes can be damaged. A streaming modulo loop keeps the arithmetic bounded and makes the checksum easy to test.

A useful test matrix includes a known synthetic value for several country lengths, the same value with print spaces, lowercase input, one changed character, a transposed pair, an unsupported country prefix, a too-short string, a too-long string, punctuation, and a check-digit edge case. The developer discussion in the research set highlights why a parser should validate the two check digits instead of accepting a misleading `00` or `97` overlap. Keep that case labeled as an implementation boundary and verify the final behavior against the current country registry.

Separate observable statuses such as `syntax_error`, `country_unsupported`, `length_error`, `pattern_error`, `checksum_error`, and `format_pass`. In logs and analytics, avoid writing full customer IBANs when a hashed or redacted test value is enough. For production account verification, hand off to the bank or payment provider rather than adding a hidden network request to a local format checker.

function ibanMod97(input) {
  const value = input.replace(/[ \t\r\n]/g, '').toUpperCase();
  if (!/^[A-Z]{2}[0-9]{2}[A-Z0-9]+$/.test(value)) {
    return {status: 'syntax_error'};
  }
  let remainder = 0;
  for (const character of value.slice(4) + value.slice(0, 4)) {
    const expanded = /[A-Z]/.test(character)
      ? String(character.charCodeAt(0) - 55)
      : character;
    for (const digit of expanded) {
      remainder = (remainder * 10 + Number(digit)) % 97;
    }
  }
  return {status: remainder === 1 ? 'checksum_pass' : 'checksum_error'};
}

// A country length and BBAN check must run before this checksum result is final.

The code demonstrates the arithmetic boundary only. A complete IBAN validation service still needs current country rules, clear error ordering, privacy controls, and a separate bank/provider verification path.

Use the right next step after validation

If the value fails, ask for a fresh copy from the account holder or bank. Do not use a public example as a repair template, and do not keep changing characters until a tool turns green. If the value passes and the task is software QA, store the result as a synthetic fixture with a clear environment label. If the task is a real payment, follow the receiving bank's instructions and any authorized beneficiary check required by the payment provider.

The site provides separate paths for these jobs. Use the IBAN Checker for a local format and checksum result, the IBAN Decoder to inspect supported visible fields, and the MOD-97 checksum guide for the full formula. If you need a bank-issued value, read how to find your IBAN rather than trying to generate it.

  1. Format pass for documentationRecord the tested country rule, registry version, and input normalization.
  2. QA fixtureMark the value synthetic and keep it outside customer and payment datasets.
  3. Real paymentConfirm the complete bank-issued details and use the provider's authorized verification path.

IBAN validation FAQ

What does IBAN validation check?

It can check syntax, country code, registered length, broad BBAN character rules, and the MOD-97 check-digit relationship. The exact layers depend on the registry and provider.

Does a valid IBAN mean the account exists?

No. A format and checksum pass is mathematical evidence only. It does not prove bank assignment, account status, ownership, beneficiary-name matching, or payment reachability.

How should I validate an IBAN before a payment?

Start with the bank-issued value, compare the account and payment details, run a format/checksum check, and use the receiving bank or authorized provider when an account-level confirmation is needed.

Can I validate an IBAN from a name or card number?

No. Do not derive private banking details from a name, card number, or partial account number. Ask the account-holding bank or use an authenticated channel.

What should I do when the checksum fails?

Re-copy the complete value, remove presentation spaces only, compare the first four characters and the final digits, and ask the source bank or account holder for a fresh value. Do not edit digits to force a pass.

Is an IBAN checker the same as bank verification?

No. An IBAN checker tests the string and registered format. Bank verification uses an authorized service to confirm an account or payment relationship, subject to that provider's rules.

Safe IBAN validation checklist

Validate in layers: use a trusted source, normalize presentation spaces, select the country rule, check length and BBAN characters, then run MOD-97. Report the exact status and keep failures actionable.

A passing IBAN validation result means that the character sequence is internally consistent under the tested rules. It does not prove that an account exists, that a person owns it, or that a payment will settle. Use the bank or an authorized provider for those decisions.

Format and implementation references

  • Swift IBAN Registry — Swift publishes the ISO 13616 registry and explains how national IBAN formats are registered and maintained.
  • ISO 13616 overview — The international standard defines the structure and processing context for IBANs.
  • IBAN validation implementation discussion — A developer discussion used to identify parser edge cases; treat it as implementation commentary, not a banking authority.