Format and checksum for all 27 member states, computed offline. Catches the typo before you call VIES.
With or without the country prefix, spaces and dots. Try PT501442600, DE811907980, FR40303265045.
What this checks, and what it cannot. Every EU VAT number carries a country-specific structure and, in most states, a check digit derived from the rest of the number. That is what runs here: it catches transpositions and typos instantly, offline. It cannot tell you whether the number is currently registered and valid for intra-EU trade — only the Commission's VIES service knows that, and a number that passes here can still be inactive. Use this to filter input at the point of entry, then verify the survivors against VIES.