Before Brexit, UK VAT numbers were part of the EU VIES system and could be validated with the same SOAP call as any other EU country. Since 1 January 2021, UK VAT is administered by HMRC independently, and UK numbers no longer appear in VIES. If your code queries VIES for a `GB` number, it will return `format_invalid` or `service_unavailable`. You need a validation API that routes `GB` numbers to HMRC separately.
UK VAT Number Format
UK VAT numbers follow the format `GB` followed by 9 digits. The 9-digit portion is structured as a 7-digit registration number followed by a 2-digit suffix. Branch traders also have a 3-digit branch identifier appended, giving 12 digits total. For most validation purposes, you only need the 9-digit version.
| Format | Example | Notes |
|---|---|---|
| GB + 9 digits | GB123456789 | Standard VAT number — most common |
| GB + 12 digits | GB123456789012 | Branch trader — 3-digit branch suffix |
| GBGD + 3 digits | GBGD001 | Government departments |
| GBHA + 3 digits | GBHA500 | Health authorities |
| XI + 9 digits | XI123456789 | Northern Ireland — trade in goods with EU |
The XI Prefix: Northern Ireland Special Case
Northern Ireland occupies a unique position post-Brexit: for trade in goods (not services), Northern Ireland businesses follow EU VAT rules and can be validated via a special `XI` prefix in VIES. This means a Northern Ireland company may have both a `GB` VAT number (for UK domestic trade and services) and an `XI` number (for intra-EU goods trade). When validating a Northern Ireland supplier or customer for EU goods transactions, use the `XI` number.
Validating UK VAT Numbers via TaxID API
The TaxID API routes `GB` numbers to HMRC's VAT API and `XI` numbers to VIES automatically. The request format is identical to EU countries.
async function validateUkVat(vatNumber: string) {
// GB123456789 → GET /validate/GB/GB123456789
// XI123456789 → GET /validate/XI/XI123456789
const normalised = vatNumber.replace(/[\s\-]/g, '').toUpperCase();
const prefix = normalised.startsWith('XI') ? 'XI' : 'GB';
const res = await fetch(
`https://taxid.dev/api/v1/validate/${prefix}/${normalised}`,
{ headers: { Authorization: `Bearer ${process.env.TAXID_API_KEY}` } }
);
return res.json();
}
// Usage:
const result = await validateUkVat('GB123456789');
// { valid: true, status: 'active', company_name: 'Example Ltd', ... }import os, requests
def validate_uk_vat(vat_number: str) -> dict:
normalised = vat_number.replace(' ', '').replace('-', '').upper()
prefix = 'XI' if normalised.startswith('XI') else 'GB'
resp = requests.get(
f'https://taxid.dev/api/v1/validate/{prefix}/{normalised}',
headers={'Authorization': f'Bearer {os.environ["TAXID_API_KEY"]}'},
timeout=5,
)
resp.raise_for_status()
return resp.json()What Changed After Brexit: VIES vs HMRC
| Aspect | Pre-Brexit (VIES) | Post-Brexit (HMRC) |
|---|---|---|
| Prefix | GB in VIES | GB via HMRC API, XI via VIES |
| Legal framework | EU VAT Directive | UK VAT Act 1994 |
| Format check | EU VIES validation | HMRC format rules |
| Company name returned | Yes | Yes |
| Address returned | Yes | Yes |
| Availability | Subject to VIES outages | HMRC uptime (generally more stable) |
Making Tax Digital Compliance
HMRC's Making Tax Digital (MTD) for VAT programme requires businesses to keep digital records and submit VAT returns via compatible software. For B2B sellers, this means the VAT number used to justify a zero-rated supply must be recorded digitally in your VAT account. Storing the TaxID `request_id` alongside the transaction is best practice — it provides a digitally-traceable audit reference showing that validation occurred via an API call at a specific time.
Note
UK zero-rating for B2B supplies requires proof that the customer is a UK or EU VAT-registered business. For UK-to-UK supplies, the relevant rule is UK VAT Act 1994 s.30 and VAT Notice 700. For UK-to-EU supplies (goods), the export zero-rating rules under UK VAT Notice 703 apply.
Related guides
Start validating EU VAT numbers
Free plan — 100 validations/month. No credit card required.