Generator · Italian data
Italian Codice Fiscale
Endpoint GET /v1/it/codice-fiscale
What it covers
Returns a valid Italian Codice Fiscale with a correct check character. Constrain with `sex`, age/birth-date filters (year, month, and day are encoded), and the optional `surname`/`name` to encode. Contradictory combinations are rejected with a 400. Set `invalid=true` for a deliberately wrong check character.
The codice fiscale is Italy’s personal tax code: sixteen characters encoding a surname code, a name code, the birth year, month (as a letter), day (offset by 40 for women), a place-of-birth code, and a final check character. It is alphanumeric, not purely numeric — the check is over letters and digits alike.
How it’s calculated
The sixteenth character is a mod-26 check letter computed from the first fifteen, using separate odd- and even-position value tables.
Algorithm
- Number the first fifteen characters by 1-indexed position (character 1 is position 1, “odd”).
- For each odd-position character, look up its value in the ODD table; for each even-position character, look up its value in the EVEN table.
- In the EVEN table, digits map to their face value and letters map A=0…Z=25.
- The ODD table is a special scrambled table (e.g. 0→1, 1→0, 2→5, 9→21, A→1, B→0, …).
- Sum all fifteen values, take the sum modulo 26, and map 0→A … 25→Z. That letter is the check character.
Worked example
positions 1–15 of a codice fiscale, e.g. RSSMRA85T10
Position 1 (odd): R → ODD table value
Position 2 (even): S → EVEN table value (S = 18)
… alternate ODD/EVEN across all 15 characters …
sum = Σ(odd-table values at positions 1,3,5,…) + Σ(even-table values at positions 2,4,6,…)
check = sum mod 26
map check: 0 → A, 1 → B, …, 25 → ZThe resulting letter is appended as character 16. Because the odd table is deliberately scrambled, transposing two adjacent characters changes the sum — that’s what makes the check catch common typos.
References
Edge cases
- The day field encodes sex: for women, 40 is added to the birth day, so a woman born on the 3rd carries day 43. The two-digit day therefore ranges 01–31 for men and 41–71 for women.
- The month is a letter, not a number: A, B, C, D, E, H, L, M, P, R, S, T map to January…December (skipping letters that resemble digits).
- The check character is a letter A–Z, never a digit — it is the only field computed from all fifteen preceding characters.
Gotchas
- Odd and even positions use entirely different value tables, and “odd/even” is 1-indexed — the first character is an odd position. A validator that 0-indexes will swap the two tables and reject valid codes.
- Homocodia: when two people would collide, digits in the omocodia positions are replaced with letters. This generator produces the base (non-omocodic) form.
Parameters
| Parameter | Type | Description |
|---|---|---|
| atAge | integer | Exact age in years at request time. |
| bornAfter | stringpattern ^\d{4}(?:-\d{2}(?:-\d{2})?)?$ | Born after this date or fragment (YYYY, YYYY-MM, YYYY-MM-DD). |
| bornBefore | stringpattern ^\d{4}(?:-\d{2}(?:-\d{2})?)?$ | Born before this date or fragment (YYYY, YYYY-MM, YYYY-MM-DD). |
| bornOn | stringpattern ^\d{4}(?:-\d{2}(?:-\d{2})?)?$ | Born on a date or within a fragment: YYYY, YYYY-MM, or YYYY-MM-DD. |
| 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 edge-case values. |
| 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. |
| invalid | boolean | Return a code with a deliberately wrong check character; encoded facts stay valid. |
| name | string | The given name to encode. When omitted, a plausible random name is generated. |
| olderThan | integer | Minimum age in years at request time. |
| seed | integer | Integer seed for reproducible output: the same seed always yields the same record. |
| sex | "m" | "f" | Encoded sex: "m" or "f". |
| surname | string | The surname to encode. When omitted, a plausible random surname is generated. |
| youngerThan | integer | Maximum age in years at request time. |
Response fields
| Field | Type | Description |
|---|---|---|
| value | string | The full 16-character Codice Fiscale. |
| surnameCode | string | The 3-letter surname code. |
| nameCode | string | The 3-letter name code. |
| birthDate | string | The encoded birth date in ISO `YYYY-MM-DD` form. |
| sex | "m" | "f" | Encoded sex: `m` or `f` (women carry a day offset of +40). |
Other generators for Italy
The same kind of identifier elsewhere
Try it