Generator · Irish data

Irish VAT number

Endpoint GET /v1/ie/vat

What it covers

Returns a valid Irish VAT number with a correct mod-23 check letter. Use `format` for the bare `national` body or the `IE`-prefixed `vat` form, and `standard` for the `modern` (post-2013) or `pre-2013` form. Set `invalid=true` for a VAT number with a deliberately wrong check letter.

How it’s calculated

The Irish VAT number carries a single alphabetic check character drawn from the PPSN mod-23 family: a weighted sum of the seven body digits (plus, in the modern post-2013 form, a contribution from the trailing second letter) is taken modulo 23 and mapped to a letter of the alphabet WABCDEFGHIJKLMNOPQRSTUV.

Algorithm

  1. Start with the seven-digit VAT body, e.g. d1 d2 d3 d4 d5 d6 d7. The first digit is 1-9 (no leading zero) and the rest 0-9, but the check algorithm treats any digit 0-9 uniformly.
  2. Apply the fixed position weights 8, 7, 6, 5, 4, 3, 2 to the seven digits in order (d1 gets weight 8, d2 gets 7, ... d7 gets 2).
  3. Compute the weighted sum: base = 8*d1 + 7*d2 + 6*d3 + 5*d4 + 4*d5 + 3*d6 + 2*d7.
  4. Decide the form. In the PRE-2013 form there is no trailing second letter, so the second-letter contribution is 0. In the MODERN (post-2013) form there is a fixed trailing second letter 'A', which contributes 9 * (its index in the alphabet WABCDEFGHIJKLMNOPQRSTUV). 'A' is index 1, so its contribution is 9*1 = 9.
  5. Compute total = base + secondContribution (secondContribution is 0 for pre-2013, or 9*index(secondLetter) for modern).
  6. Compute remainder = total mod 23 (a value 0-22).
  7. Map remainder to the check letter using the alphabet 'WABCDEFGHIJKLMNOPQRSTUV', where index 0 = W, index 1 = A, index 2 = B, ..., index 22 = V. The character at position 'remainder' is the check letter.
  8. Assemble the body: pre-2013 = seven digits followed by the check letter (e.g. 1234567T). Modern = seven digits followed by the check letter followed by the fixed second letter 'A' (e.g. 1234567FA). Optionally prefix 'IE' for the full VAT-format value.

Worked example

Pre-2013 Irish VAT body 1234567? (check letter unknown)

Body digits: 1 2 3 4 5 6 7; weights: 8 7 6 5 4 3 2.
Weighted products: 1*8=8, 2*7=14, 3*6=18, 4*5=20, 5*4=20, 6*3=18, 7*2=14.
base = 8+14+18+20+20+18+14 = 112.
Pre-2013 form: no second letter, so secondContribution = 0. total = 112.
remainder = 112 mod 23. 23*4 = 92, 112 - 92 = 20, so remainder = 20.
Map 20 into 'WABCDEFGHIJKLMNOPQRSTUV': index 0=W, 1=A, 2=B, 3=C, 4=D, 5=E, 6=F, 7=G, 8=H, 9=I, 10=J, 11=K, 12=L, 13=M, 14=N, 15=O, 16=P, 17=Q, 18=R, 19=S, 20=T. Index 20 = T.
Check letter = T.

The check letter is T, giving the full pre-2013 Irish VAT number 1234567T (or IE1234567T in VAT format).

Edge cases

  • Two historical forms coexist. The pre-2013 form is 7 digits + 1 check letter (e.g. 1234567T). The modern post-2013 form appends a fixed second letter 'A' after the check letter (e.g. 1234567FA) and folds 9*index('A')=9 into the total, so the same seven digits produce a DIFFERENT check letter across the two forms.
  • The check character is a LETTER, not a digit. It comes from the 23-character alphabet 'WABCDEFGHIJKLMNOPQRSTUV' where W (not A) sits at index 0, so a remainder of 0 yields 'W'.

Gotchas

  • The alphabet is offset: index 0 maps to 'W', index 1 to 'A', up to index 22 to 'V'. Do not assume A=0 — a remainder of 0 gives W and a remainder of 1 gives A.
  • In the modern form the second letter is a fixed 'A' (MODERN_SECOND_LETTER in create-generator.ts), and it feeds the checksum as 9 * charToValue('A', alphabet) = 9*1 = 9 before the mod-23 is taken; it is not merely appended cosmetically.
  • The modulus is 23 (the PPSN/mod-23 family), and the weights 8,7,6,5,4,3,2 descend across exactly seven digits — this is unrelated to the mod-11 or mod-97 schemes used by other identifiers even though the weightedSum helper it reuses lives in mod11.ts.

Parameters

ParameterTypeDescription
countinteger1–1000Number of records to return, 1–1000 (your plan may lower this). Omitted returns a single record; set it for a batch.
edgebooleanRestrict output to valid edge-case VAT numbers from the rare corners.
extremebooleanReturn a correct value wrapped in a hostile encoding (untrimmed whitespace, invisible/zero-width characters, BOM, or bidi/combining marks). Homoglyphs are excluded so the value stays machine-parseable; it still validates after normalisation.
format"national" | "vat"Rendering: bare `national` body (default) or `vat` (`IE` prefix).
invalidbooleanReturn a VAT number with a deliberately wrong check letter.
seedintegerInteger seed for reproducible output: the same seed always yields the same record.
standard"pre-2013" | "modern" | "both"VAT form: `modern` (post-2013, default), `pre-2013`, or `both` (random per record).

Response fields

FieldTypeDescription
valuestringThe VAT number in the requested format.
digitsstringThe canonical seven-digit body.

Other generators for Ireland

See all generators for Ireland →

The same kind of identifier elsewhere

Try it

Generate a live example below — every response is valid by format and entirely synthetic.