Generator · Greek data
Greek AFM
Endpoint GET /v1/gr/afm
What it covers
Returns a valid Greek AFM (tax registration number, used by both persons and companies) with a correct check digit. Use `format=vat` for the EL-prefixed VAT number. Set `invalid=true` for an AFM with a deliberately wrong check digit.
How it’s calculated
The Greek AFM's 9th digit is a weighted mod-11 check digit over the first eight digits, using powers-of-two weights 256..2, taken as the plain remainder and reduced mod 10 so it is always a single digit 0-9.
Algorithm
- Take the eight payload digits d1..d8 (the AFM is nine digits; the ninth is the check digit being computed). Read them left to right as integers 0-9.
- Assign position weights, most significant digit first: w = [256, 128, 64, 32, 16, 8, 4, 2] (i.e. 2^8 down to 2^1). d1 pairs with 256, d2 with 128, ..., d8 with 2.
- Compute the weighted sum S = 256*d1 + 128*d2 + 64*d3 + 32*d4 + 16*d5 + 8*d6 + 4*d7 + 2*d8.
- Take the remainder modulo 11: base = S mod 11 (a value 0-10).
- Because AFM uses the 'remainder' style, the raw check value is raw = base (no 11-complement is applied).
- Apply the 'mod10' overflow rule: checkDigit = raw mod 10. This maps the single awkward residue 10 to 0, so the result is always a single digit 0-9; no residue is ever rejected.
- Append checkDigit as the ninth digit to form the full 9-digit AFM: d1 d2 d3 d4 d5 d6 d7 d8 checkDigit.
Worked example
AFM payload 12345678? (compute the 9th/check digit)
Payload digits: d1..d8 = 1,2,3,4,5,6,7,8.
Weights: 256,128,64,32,16,8,4,2.
Products: 256*1=256; 128*2=256; 64*3=192; 32*4=128; 16*5=80; 8*6=48; 4*7=28; 2*8=16.
Weighted sum S = 256+256+192+128+80+48+28+16 = 1004.
base = 1004 mod 11: 11*91 = 1001, so 1004 - 1001 = 3, base = 3.
remainder style: raw = base = 3.
mod10 overflow: checkDigit = 3 mod 10 = 3.
Ninth digit = 3.The check digit is 3, giving the full AFM 123456783.
Edge cases
- Leading-zero AFM: the first payload digit can be 0, producing a valid 9-digit AFM that drops below nine digits if parsed as a number (the edge generator emits this deliberately).
- Zero check digit: residue 0 (or the residue 10, which the mod-10 overflow rule folds down to 0) yields a ninth digit of 0 — a fully valid AFM.
- Repeated-pattern payload: all eight payload digits equal (e.g. 88888888) still produces a valid check digit; it is a valid corner, not a rejected input.
Gotchas
- Weights are powers of two 256,128,64,32,16,8,4,2 applied most-significant digit first — not a 1..9 or 3-1-7 sequence. Aligning them from the wrong end gives a wrong check digit.
- The check value is the plain remainder (S mod 11), NOT the 11-complement used by many other European mod-11 schemes (CVR, NIF, IČO). Do not compute 11 - (S mod 11).
- The overflow rule is mod10: a residue of 10 becomes 0 rather than marking the number invalid, so every eight-digit payload has exactly one valid AFM and none are 'unissued'.
- The VAT form prefixes the AFM with EL (not GR); the check-digit math is identical and operates only on the nine digits.
Parameters
| Parameter | Type | Description |
|---|---|---|
| count | integer1–1000 | Number of records to return, 1–1000 (your plan may lower this). Omitted returns a single record; set it for a batch. |
| edge | boolean | Restrict output to valid edge-case AFMs from the rare corners. |
| extreme | boolean | Return 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 9-digit AFM (default), or the EL-prefixed VAT number. |
| invalid | boolean | Return an AFM with a deliberately wrong check digit. |
| seed | integer | Integer seed for reproducible output: the same seed always yields the same record. |
Response fields
| Field | Type | Description |
|---|---|---|
| value | string | The identifier in the requested format (national or VAT). |
| digits | string | The canonical, unprefixed 9-digit AFM. |
Other generators for Greece
Greek AMKAGreek companyGreek company nameGreek email addressGreek IBANGreek personGreek person nameGreek product or service offeringGreek vehicle registration plate
See all generators for Greece →The same kind of identifier elsewhere
Austrian data · Austrian SVNRBelgian data · Belgian RijksregisternummerBulgarian data · Bulgarian EGNCroatian data · Croatian JMBGCroatian data · Croatian OIBCypriot data · Cyprus TICCzech data · Czech rodné čísloDanish data · Danish CPRDutch data · Dutch BSNEstonian data · Estonian isikukoodFinnish data · Finnish henkilötunnusFinnish data · Finnish Y-tunnusFrench data · French NIRGerman data · German Steuer-IdNrHungarian data · Hungarian adóazonosító jelHungarian data · Hungarian személyi azonosítóHungarian data · Hungarian TAJIrish data · Irish PPSNItalian data · Italian Codice FiscaleLatvian data · Latvian personas kodsLithuanian data · Lithuanian asmens kodasLuxembourg data · Luxembourg matriculePolish data · Polish PESELPortuguese data · Portuguese NIFRomanian data · Romanian CNPSlovak data · Slovak rodné čísloSlovenian data · Slovenian davčna številkaSlovenian data · Slovenian EMŠOSpanish data · Spanish DNISpanish data · Spanish NIESwedish data · Swedish personnummer
Try it