A VAT number is the identifier a business uses for value-added tax across the European Union. Each member state has its own format — different lengths, prefixes, and in some cases a check digit that must satisfy a published algorithm. When testing tax, invoicing, or checkout tools you need values that look right structurally. This tool generates fictional, correctly-formatted VAT numbers per country, with a valid check digit where the country defines one. They are for testing only and are not registered to any business.
How it works
Every EU VAT number begins with a two-letter ISO country code, followed by the national number. The generator:
- Reads the country you select and looks up its exact format — length and any structural quirks.
- Fills the national portion with random digits.
- For countries with a deterministic public check digit (for example Germany’s modulus-11 routine and the Netherlands’ modulus-11 over nine digits), it computes and appends the correct final digit so the number passes a local format validation.
The country prefix is then prepended to produce the complete VAT identifier.
Country formats at a glance
EU VAT formats vary significantly in length and structure. A few examples to illustrate:
| Country | Prefix | Format | Example |
|---|---|---|---|
| Germany | DE | 9 digits, check digit | DE123456789 |
| France | FR | 2 alpha-numerics + 9 digits | FR12345678901 |
| Netherlands | NL | 9 digits + B + 2 digits | NL123456789B01 |
| Spain | ES | 9 chars (letter/digit/letter) | ES12345678A |
| Sweden | SE | 12 digits | SE123456789001 |
| Italy | IT | 11 digits | IT12345678901 |
The Netherlands format is especially unusual — the B character in the middle is a literal separator, not a digit or letter code. Italy and Germany have 11 and 9 digits respectively with different check-digit algorithms. France uses a two-character alpha-numeric block that can include letters, which is why a simple [A-Z]{2}\d{9} regex fails on French VAT numbers.
Format validation versus VIES lookup
The EU provides the VIES (VAT Information Exchange System) service for live lookup of registered VAT numbers. Testing against VIES from a development environment can cause rate limiting issues, and live lookups are not suitable for unit tests that need deterministic results.
The generated numbers here pass format validation — the structural check that a front-end or parsing library performs — while intentionally failing a VIES registry lookup. This two-layer distinction is important to understand when building a checkout or invoicing tool:
- Format check — does this string match the expected pattern for its country prefix? Generated numbers pass this.
- Registry check — is this VAT number registered to an active business in VIES? Generated numbers fail this, which is exactly what you want for test data.
Build your tests to exercise both layers separately. Use generated numbers to test the format layer; use a dedicated stub or mock for the VIES call.
Practical tips
- Use a country with a known check-digit rule (such as DE or NL) when you want to verify your own check-digit validator produces the same result.
- Generate a batch across multiple countries to stress-test a parser that must handle the full EU format variety.
- These numbers are designed to pass format validation but to fail a registry lookup — ideal safe test data that will not accidentally match a real business.
- Everything runs locally with no API call, so you can generate freely without internet access.