Skip to content

How to calculate an IBAN from your bank account number

6 min read June 16, 2026
ibancheck digitsmod-97payments

You build an IBAN by joining your country code, bank code and account number, then computing two check digits with mod-97. The formula is short and always the same.

How to calculate an IBAN from your bank account number — Hivly

You have a domestic bank account and someone abroad needs to pay you, but the form asks for an IBAN you have never had to write down. The good news is that there is nothing to guess. An IBAN is calculated from details you already have, by a formula that is the same everywhere. Here is the whole method.

TL;DR: To build an IBAN, lay out your country code, bank code and account number in your country’s format, drop two zeros in the check-digit slot, and run a mod-97 calculation to replace those zeros with the real check digits. The inputs are yours; the only computed part is those two digits.

What you need before you start

An IBAN is not built from your account number alone. It is built from your full national account identity, which usually means three things: your country, your bank’s code, and your account number. Some countries fold in a branch code or a national check digit too.

So before any calculation, gather the pieces your country uses:

  • The country code, the easy part. DE, GB, FR, NL, ES, and so on.
  • The bank code, and a branch code if your country has one. In the UK this is the four-character bank code plus the six-digit sort code; in Germany it is the eight-digit Bankleitzahl.
  • The account number, in the exact length your country expects, often zero-padded on the left.

Put together, the bank details and account number form the BBAN, the part of the IBAN that comes after the first four characters. Get the BBAN right and the rest is pure arithmetic.

Building the BBAN

The BBAN is just your national account details, written in the fixed order and length your country defines, with no spaces. A German BBAN is the eight-digit bank code immediately followed by the ten-digit account number, so bank code 37040044 and account 0532013000 give a BBAN of 370400440532013000.

The two things to watch are order and padding. Each country puts the bank code, branch code and account number in a specific sequence, and each field has a fixed width that you pad with leading zeros if your number is shorter. An account number that is not padded to the right length will produce check digits that do not match, so this step matters as much as the math that follows.

Computing the two check digits

Now the only calculated part. The two check digits go right after the country code, and you work them out like this.

Start with a placeholder. Write the IBAN as country code, then 00 for the check digits, then your BBAN. For our German example: DE00 370400440532013000.

Move the front to the back. Take the country code and the 00 placeholder and move them to the end: 370400440532013000 DE00.

Turn letters into numbers. Replace each letter with its position value, A is 10 up to Z is 35. D is 13, E is 14, so DE00 becomes 131400. The string is now all digits.

Take it modulo 97, then subtract from 98. Read the whole digit string as one integer, divide by 97, and keep the remainder. The check digits are 98 minus that remainder. If the answer is a single digit, pad it with a leading zero so it is always two characters.

Slot those two digits in where the 00 was, and you have a complete, valid IBAN. The 98-minus-remainder step is the mirror image of the validation check, which expects the final remainder to come out at 1; doing it this way guarantees it will. Rather than run the arithmetic by hand every time, you can enter your country, bank code and account number into the IBAN calculator at finance.hivly.net and read off the finished number with its check digits already in place.

A sanity check on what you built

One caution worth repeating: the formula is happy to build an IBAN from wrong inputs. Feed it a mistyped account number and it will faithfully produce a valid-looking IBAN for an account that does not exist. The math only guarantees that the number is well-formed, not that it points anywhere real.

So treat calculation and verification as two separate jobs. Build the IBAN from your account details, then paste it back into a validator as a quick proof you assembled it correctly. If the check digits you computed survive the validation round-trip, your formatting and padding were right, and you can hand the number over with confidence that, at least, it is structurally sound.

Try the finance calculatorsMortgage, loan, retirement, savings, tax and interest math, plus IBAN tools, worked out instantly.

Frequently asked questions

How are IBAN check digits calculated?
You write the IBAN with 00 in the check-digit slot, move the country code and that 00 to the end, convert letters to numbers (A is 10 up to Z is 35), read the whole thing as one integer and take it modulo 97. The check digits are 98 minus that remainder, padded to two digits.
Can I make up an IBAN from just my account number?
Only if you also have the right bank and branch codes for your country, in the correct positions and lengths. The account number alone is not enough. Once you have the full national account details, the IBAN is fully determined; there is nothing to invent, only to compute.
Does calculating an IBAN mean the account exists?
No. The formula produces a structurally correct IBAN from whatever inputs you give it. If the underlying account number is wrong, you will get a valid-looking IBAN for an account that does not exist. The math guarantees form, not reality.
Is the check-digit formula the same for every country?
The mod-97 formula for the two check digits is identical for every country. What differs is the BBAN that goes into it, the national arrangement of bank code, branch code and account number, which has its own length and layout per country.

Keep reading

Building something bigger?

Hivly is made by CodingEagles, a software studio that ships production web apps. If you have a real project, get in touch.

See what CodingEagles does →