UK IBAN & Bank Details Checker

A UK bank details checker validates the structure of a sort code, account number, IBAN and BIC, and verifies the ISO 7064 check digits that an IBAN carries.

A UK bank account is a six-digit sort code and an eight-digit account number. Internationally the same account is a 22-character IBAN (GB, two check digits, a four-letter bank code, the sort code and the account number) and the bank is an 8- or 11-character BIC. The IBAN check digits are verified with the MOD 97-10 calculation every bank uses, so a mistyped character is caught at once. The tool also builds a correct IBAN from its parts, explains each field, and generates fictional bank details whose sort codes begin 00 and whose bank code is TEST, so they pass validators without resolving to any real bank.

Use cases

  • Payment form validation: Check IBANs before they reach your payment provider and give users a precise error instead of a generic failure.
  • Test data for Direct Debit and payout flows: Fictional sort codes, account numbers and IBANs that pass format checks, for fixtures that must never contain a real person’s bank details.
  • Understanding a rejected IBAN: See the bank code, sort code and account number inside an IBAN and which part breaks the UK layout.

Frequently asked questions

Does this run the UK modulus check on the sort code and account number?

No. The modulus check needs the weight tables Pay.UK publishes, which change and carry many exceptions. This tool checks formats and the IBAN check digits. Use a maintained library or your payment provider for modulus checking.

Can I use the generated bank details in a payment sandbox?

For end-to-end tests use the magic values your payment provider documents, which trigger specific outcomes. The generated details here are for validating forms and parsers.

Why does a valid IBAN still get rejected by my bank?

An IBAN’s check digits protect against typing errors in the string; they say nothing about whether the account is open, or whether the sort code and account number pass modulus checking.

UK bank identifiers and how far a format check goes

Sort codes, account numbers, IBANs and BICs, with the one check digit you can verify offline · 700 words

1. Four identifiers for one account

A UK bank account is identified domestically by a six-digit sort code, printed in three pairs such as 20-00-00, and an eight-digit account number. Abroad the same account is quoted as a 22-character IBAN, and the bank as an 8- or 11-character BIC, also called a SWIFT code. The sort code identifies the bank and branch, but decades of mergers mean the allocation cannot be decoded by eye; treat it as an opaque identifier whose existence is confirmed by the industry sorting code directory, not by its digits.

Account numbers are eight digits. A few banks historically issued six, seven, nine or ten digit numbers, with published rules for converting them to eight, but anything a user types today should be eight digits with its leading zeros intact. Storing an account number as an integer loses them.

2. The IBAN check digit

A UK IBAN is GB, two check digits, four letters taken from the bank's BIC, the six-digit sort code and the eight-digit account number: GB82 WEST 1234 5698 7654 32 is the example used throughout banking documentation and is not a real account. The check is ISO 7064 MOD 97-10 and is the same in every country. Move the first four characters to the end, replace each letter with two digits (A is 10, B is 11, through to Z as 35), and the resulting number modulo 97 must be 1. To build an IBAN, run the same calculation with 00 as the check digits and use 98 minus the remainder.

The IBAN check catches typing errors anywhere in the string. It does not run the UK modulus check on the sort code and account number inside it, so a well-formed IBAN can still wrap an account number that fails modulus checking.

function isValidIban(input) {
  const iban = input.toUpperCase().replace(/\s+/g, '');
  const numeric = (iban.slice(4) + iban.slice(0, 4)).replace(/[A-Z]/g, (c) => String(c.charCodeAt(0) - 55));
  let remainder = 0;
  for (const d of numeric) remainder = (remainder * 10 + Number(d)) % 97;
  return remainder === 1;
}

3. Modulus checking, and why this tool does not do it

The sort code and account number together can be checked for internal consistency before a payment is attempted. Each of the fourteen digits is multiplied by a weight, the products are summed, and the total must divide by 10 or 11 depending on the method. The weights and the method depend on the sort code range, a range can require one check or two, and a list of numbered exceptions modifies the rules for particular banks. Pay.UK publishes the specification and the weight tables, and they change.

Hand-writing the table is a mistake: a wrong row rejects real customers. Use a maintained library that ships the current table, or your payment provider's validation endpoint. And remember what a pass means: the numbers are consistent with each other. Only a Confirmation of Payee check or the payment itself says the account is open and belongs to the named person.

4. Bank details in test data

Never copy real bank details into fixtures, including your own. A sort code and account number is enough to set up a Direct Debit in someone's name, and test databases are copied and backed up far more casually than production. Payment providers that support Bacs or UK transfers document test values for their sandboxes, usually specific numbers that trigger success, failure or a pending state; those are the right values for end-to-end tests.

For pure validation tests, generate. The fictional details this tool produces use sort codes starting 00, a range no UK bank holds, and the bank code TEST, with the IBAN built around them so its check digits are correct. They pass every structural check and can never resolve to a real bank.

More questions

What is the difference between an IBAN and a BIC?

The IBAN identifies the account; the BIC identifies the bank. A UK IBAN contains the sort code and account number, and its four-letter bank code is the start of the bank’s BIC. International payments usually need both.

Does an 8-character BIC mean something different from 11?

No. The optional three-character branch code defaults to the head office, and XXX in that position means the same thing. NWBKGB2L and NWBKGB2LXXX are the same place.

Can a valid IBAN be rejected by a bank?

Yes. The check digits only prove the string was typed correctly. The account may be closed, the sort code may not accept the payment scheme, or the sort code and account number may fail modulus checking.

Related tools