The structure of a SWIFT code
A SWIFT code, officially a BIC (Business Identifier Code), is defined by ISO 9362 and issued by SWIFT, the registration authority. It identifies a bank or another institution in international payment messages. Every BIC has 8 or 11 characters in four parts:
| Part | Characters | Meaning |
|---|---|---|
| Institution code (business party prefix) | 1–4, four letters (digits allowed since ISO 9362:2014) | Chosen by the institution, often an abbreviation of its name |
| Country code | 5–6, two letters | ISO 3166-1 alpha-2 code of the country where the institution is located; SWIFT also uses XK for Kosovo |
| Location code | 7–8, letters or digits | Identifies the city or region; the second character has special meanings (below) |
| Branch code | 9–11, optional | A specific branch or department; XXX means the primary office |
The country code is the part a checker can verify most reliably: it must be one of the roughly 250 ISO country codes. The country in the BIC is where the institution sits, not necessarily the currency of the payment. The institution code, by contrast, cannot be checked without SWIFT’s directory — four valid letters are not enough to know that a bank uses them.
Special location codes
- Second character
0— normally a test and training BIC, used for testing on the SWIFT network rather than for live traffic. Handy as a safe value in your own test data. - Second character
1— a passive participant: the institution is reachable but not connected to SWIFT directly; messages go through another bank. - Second character
2— usually a reverse-billing BIC, where the receiver pays for the message.
The checker flags all three. None of them makes a BIC invalid, but a test BIC in a live payment file is almost certainly a mistake.
8 or 11 characters?
An 8-character BIC identifies the institution’s primary office. Adding XXX gives the same meaning in 11 characters, and many payment forms expand 8-character BICs that way, so EXMPGB2L and EXMPGB2LXXX refer to the same office. Any other branch code points to a specific branch or unit. When a payee gives you an 11-character BIC, use it as given.
Validating BICs in your own code
A regular expression covers the structure:
^[A-Z0-9]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?$
Use [A-Z]{4} for the first part instead if your downstream systems predate ISO 9362:2014 and reject digits. Before matching, convert to upper case and remove spaces, because people often type BICs in lower case or copy them with spaces from a PDF. Then check the two country letters against a list of ISO 3166 codes — a regex alone accepts ZZ. Finally, if the payment also has an IBAN, compare the BIC’s country code with the IBAN’s first two letters: they usually match, and a mismatch is worth a warning (not an error — some banks hold accounts abroad).
What no format check can tell you is whether the BIC is in use and which institution it belongs to. That information is in SWIFT’s BIC directory, a licensed product. When you receive a BIC for a payment, confirm it with the recipient or their bank.
Is a SWIFT code needed for SEPA payments?
No. For euro transfers within the SEPA area the IBAN is enough, and banks derive the BIC themselves. A BIC is still needed for many international transfers outside SEPA, and some forms ask for it anyway. To check the account side of a payment, use the IBAN checker. For US domestic transfers, banks use a 9-digit ABA routing number instead — see the routing number validator.
Frequently asked questions
Is a SWIFT code the same as a BIC?
Yes. BIC (Business Identifier Code) is the official name in ISO 9362; “SWIFT code” is the everyday name, because SWIFT is the registration authority that issues them.
Does a valid format mean the bank exists?
No. The checker only tests the structure. Whether a BIC is assigned, and to which institution, is recorded in SWIFT’s BIC directory. Confirm the BIC with the recipient or their bank before you send money.
8 or 11 characters — which should I use?
Both identify the same institution. The 8-character form means the primary office; 11 characters add a branch code. XXX as the branch code also means the primary office, so an 8-character BIC and the same BIC with XXX are equivalent.
What is a test BIC?
A BIC whose location code ends in 0, such as …GB20, is normally a test and training BIC used outside the live network. The checker flags these.