UK postcode, NI number and IBAN formats explained
Forms ask for them all the time: a postcode, a National Insurance number, a sort code and account number, an IBAN for an international payment, a VAT number on an invoice. Each follows a fixed pattern, and knowing the pattern helps you spot a typing mistake before a form rejects your entry or a payment goes astray. This guide explains how each identifier is built, gives the rules that decide whether the format is valid, works through an IBAN check with the actual method, and is clear about what a format check can and cannot tell you. A correctly formatted number is not necessarily a real one, and a validator is not the same as a lookup against official records.
UK postcodes
A postcode has two parts separated by a space: the outward code and the inward code. The inward code is always a digit followed by two letters, such as 1AA. The outward code is one or two letters, then one or two digits, and sometimes a final letter or digit, such as SW1A, M1, B33 or EC1A.
The valid shapes are A9 9AA, A99 9AA, A9A 9AA, AA9 9AA, AA99 9AA and AA9A 9AA, where A is a letter and 9 a digit. Examples: M1 1AE, B33 8TH, CR2 6XH, DN55 1PT, W1A 1HQ and EC1A 1BB. Letters Q, V and X are not used in the first position, I, J and Z are not used in the second position, and the letters C, I, K, M, O and V are not used in the last two positions of the inward code. There is also one special code, GIR 0AA.
People often type a postcode in lowercase or without the space. A good form accepts both and tidies it up, putting the space before the last three characters, since the inward code is always three characters long.
What a postcode check proves
A format check tells you the text looks like a UK postcode. It does not tell you whether the postcode exists, because many combinations that fit the pattern have never been assigned. Royal Mail maintains the real list and changes it, as new streets are built and others are removed.
For an address that must be right, such as a delivery, use an address lookup that returns a full address for the postcode and let the customer choose from it. For a quick check on a form, the format test catches most typing slips, such as a missing character, an O typed for a zero or a letter in the wrong place.
Postcodes also differ from the counties and the local authority areas people think of. A single postcode can sit across a boundary, and the area names in postcodes do not always match the place names.
National Insurance numbers
A National Insurance number is two letters, six digits and a final letter, written in pairs for readability, such as QQ 12 34 56 C. The final letter is A, B, C or D. HMRC and GOV.UK use QQ 12 34 56 C as the example, and it is not a real person's number.
Not every letter combination is allowed. The first letter cannot be D, F, I, Q, U or V, and the second letter cannot be D, F, I, O, Q, U or V. The prefixes BG, GB, KN, NK, NT, TN and ZZ are not allocated.
You need to give your NI number to your employer, and you will find it on payslips, tax documents and letters from HMRC. If you have lost it, the official route is to look on your payslip, your P60, or through your online personal tax account. Do not share it on forms that have no good reason to ask for it.
Sort codes and account numbers
A UK bank account is identified by a six-digit sort code, written as three pairs such as 12-34-56, and an account number of normally eight digits. The sort code identifies the bank and the branch or processing centre. The account number identifies the account.
Some older or special accounts have shorter numbers of six or seven digits, which are padded with zeros at the front to make eight. Building societies may use a roll number in addition to the account number.
Banks can check that a sort code and account number pass a modulus test, a calculation that catches most typing errors, but it does not show that the account belongs to the person you intend to pay. For that, banks offer a payee name check when you set up a payment. Take the check seriously and stop if the name does not match.
IBANs
An IBAN, or International Bank Account Number, is the standard format for sending money abroad. A UK IBAN has 22 characters: the country code GB, two check digits, a four-letter code for the bank, the six-digit sort code and the eight-digit account number. A standard example used in the documentation is GB82 WEST 1234 5698 7654 32.
The check digits let anyone test the IBAN. Move the first four characters to the end, so the example becomes WEST12345698765432GB82. Replace each letter with a number, A as 10, B as 11, up to Z as 35. W becomes 32, E becomes 14, S becomes 28, T becomes 29, G becomes 16 and B becomes 11. The long number is then divided by 97. If the remainder is 1, the IBAN passes.
This test catches nearly all single typing errors and swapped digits. It cannot tell you that the account exists or belongs to the right person. IBANs from other countries have different lengths, from 15 to 34 characters, so a validator must know the length for each country.
VAT numbers
A UK VAT number is the letters GB followed by nine digits, such as GB 123 4567 89, or 12 digits for a branch. The last two digits of the nine are check digits, calculated from the first seven, and a validator can test them. Numbers for government departments and health authorities have a different pattern.
As with the other identifiers, passing a format and check test does not prove that the business is registered today. To confirm that a trader is registered for VAT, use the official online check on GOV.UK, and keep a record of when you did it.
On an invoice, the supplier's VAT number must appear. If you do not see one, or the number fails the check, ask the supplier before you pay, because you may not be able to reclaim VAT without a valid invoice.
Phone numbers and other formats
UK mobile numbers start with 07 and have 11 digits in total, for example 07xxx xxxxxx. Landlines start with 01 or 02 and have 10 or 11 digits, depending on the area. For international use, drop the first 0 and add +44, so 07123 456789 becomes +44 7123 456789.
Other common identifiers include the Unique Taxpayer Reference, which has 10 digits, and a company registration number at Companies House, which has 8 characters, sometimes starting with letters such as SC for Scotland or NI for Northern Ireland. Each has its own pattern.
The golden rule is to be forgiving on entry and strict on storage. Accept spaces, dashes and lowercase from the person typing, remove them, and store a clean version.
Practical tips
When a form rejects your entry, check for a space at the start or end, a letter O in place of a zero, or a lowercase l instead of the number 1. Copying and pasting from a document can bring extra characters, so type it afresh if in doubt.
Before you send money, read back the sort code, account number or IBAN from the invoice by phone using a number you already trust, as fraudsters sometimes change bank details on emailed invoices.
Share these identifiers with care: give them only when there is a clear reason and only to the right organisation.
Tools mentioned in this guide
UK Postcode Validator
Check UK postcodes for the right format and tidy them to the standard layout.
Money & taxNational Insurance Number Checker
Check that a National Insurance number is in the right format. Format check only.
Money & taxIBAN Validator
Check an IBAN for the right length and valid check digits, and see the country.
Money & taxVAT Number Format Checker
Check that a UK or EU VAT number is written in the right format. Format check only.
TextPhone Number Formatter
Format UK and international phone numbers as national, international or E.164.
Money & taxCard Number Validator
Check card numbers with the Luhn check digit test and see the likely card network.
Frequently asked questions
What format is a UK postcode?
An outward code of one or two letters and one or two digits, sometimes with a final letter or digit, then a space and an inward code of a digit and two letters, as in SW1A 1AA.
What does a valid National Insurance number look like?
Two letters, six digits and a final letter A to D, such as QQ 12 34 56 C. Some letters and prefixes are never used.
How long is a UK IBAN?
22 characters: GB, two check digits, four letters for the bank, a six-digit sort code and an eight-digit account number.
Does a valid format mean the account or number is real?
No. A format check catches typing errors but does not prove that the number exists or belongs to the person you intend.
How do I convert a UK mobile number to international format?
Remove the first 0 and add +44. 07123 456789 becomes +44 7123 456789.