It codice fiscale parse
it-codice-fiscale-parse · version 1.0.0 · Identifiers & check digits · free, no key needed
Parse an Italian codice fiscale: birth date, sex, place code, check character; optionally match a surname/given name.
Use when you need to: parse an italian codice fiscale · get birth date from italian fiscal code · validate a codice fiscale check character.
Decide before calling
Read the versioned contract and the supported scope below. Reuse it-codice-fiscale-parse@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use it-codice-fiscale-parse@1.0.0 for parse an italian codice fiscale. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- parse an italian codice fiscale
- get birth date from italian fiscal code
- validate a codice fiscale check character
- check if a name matches a codice fiscale
- italian tax code sex digit
- what does the omocodia letter mean in a codice fiscale
- verifica codice fiscale
Not supported
- resolving the belfiore_code into a comune (place of birth) name (no place-name data is pinned)
- reversing the omocodia substitution priority order used by the Anagrafe Tributaria to resolve real collisions
- accepting lowercase input or trimming whitespace
Behavior
- codice_fiscale must be exactly 16 characters matching the structural pattern; each year/day/place slot is a decimal digit or one of the ten omocodia letters L,M,N,P,Q,R,S,T,U,V; the month slot is one of the 12 letters A,B,C,D,E,H,L,M,P,R,S,T. Any other value throws invalid_input; no case folding.
- date_digit maps 0-9 to themselves and the omocodia letters L..V to 0-9 in that same order; used for the two year and two day characters only, never the three place characters.
- sex is female when the 2-digit day value is >= 41 (the official +40 offset), male otherwise; birth_day subtracts 40 from that value for a female code. birth_day must be 1..days-in-month under a fixed, leap-permissive table (February always 29 days, since the 2-digit year leaves the century undetermined); an invalid day reports reason invalid_date and takes precedence over a checksum mismatch.
- belfiore_code is characters 12-15 returned unresolved (no comune lookup); omocodia_level counts, among the 7 year/day/place character slots, how many are an omocodia letter rather than a digit.
- check_char sums ODD_TABLE (odd 1-based positions) and EVEN_TABLE (even positions) over the first 15 characters per the DM 1976 Allegato A tables, then takes letter (sum mod 26); a mismatch with the given 16th character is reason checksum_mismatch.
- name_letters(text) applies Unicode NFD, drops combining marks, uppercases, and keeps only A-Z; a supplied surname or given_name that normalizes to zero letters throws invalid_input. surname_code_of takes the first 3 consonants (padding with the string's own vowels then 'X' if it runs out); name_code_of does the same unless there are >= 4 consonants, in which case it takes the 1st, 3rd and 4th consonant (skipping the 2nd).
- name_match is null when neither surname nor given_name was supplied, true only if every supplied one matches its own 3-letter code in codice_fiscale, false otherwise; it never affects valid or reason.
- Pure fixed-table lookups and integer arithmetic; no locale, clock, or randomness beyond the runtime's Unicode version used for NFD; identical output across runs for the same input.
Input
codice_fiscale(string, required): min length 16; max length 16; pattern^[A-Z]{6}[0-9LMNPQRSTUV]{2}[ABCDEHLMPRST][0-9LMNPQRSTUV]{2}[A-Z][0-9LMNPQRSTUV]{3}[A-Z]$surname(string, optional): min length 1; max length 60given_name(string, optional): min length 1; max length 60
Output
valid(boolean, required)reason(one of null, "invalid_date", "checksum_mismatch", required)surname_code(string, required): pattern^[A-Z]{3}$name_code(string, required): pattern^[A-Z]{3}$birth_year_2d(string, required): pattern^\d{2}$birth_month(integer, required): min 1; max 12birth_day(integer, required): min 0; max 59sex(one of "male", "female", required)belfiore_code(string, required): pattern^[A-Z][0-9LMNPQRSTUV]{3}$omocodia_level(integer, required): min 0; max 7check_char(string, required): pattern^[A-Z]$name_match(boolean or null, required)
Limits
- max codice fiscale bytes: 16
- max surname bytes: 60
- max given name bytes: 60
Example
Request input:
{
"codice_fiscale": "RCCMNL83S18D969H"
}
Response:
{
"result": {
"valid": true,
"reason": null,
"surname_code": "RCC",
"name_code": "MNL",
"birth_year_2d": "83",
"birth_month": 11,
"birth_day": 18,
"sex": "male",
"belfiore_code": "D969",
"omocodia_level": 0,
"check_char": "H",
"name_match": null
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "it-codice-fiscale-parse",
"version": "1.0.0",
"input": {
"codice_fiscale": "RCCMNL83S18D969H"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/it-codice-fiscale-parse/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"codice_fiscale":"RCCMNL83S18D969H"}'
The machine-readable contract is at /v1/tools/it-codice-fiscale-parse/versions/1.0.0.
CLI
node cli.mjs run it-codice-fiscale-parse 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Se personnummer parse: Parse a Swedish personnummer/samordningsnummer: resolve its century, return birth date, sex and Luhn validity.
- Iban validate: Validate an IBAN's country, registry length, BBAN structure and MOD 97-10 check digits, and parse its bank/branch code.
- Bic validate: Validate a Business Identifier Code's ISO 9362:2022 structure and parse its party prefix, country, location and branch.
- Cn resident id parse: Parse an 18-digit (or legacy 15-digit) Chinese resident ID: region code, birth date, sex and GB 11643-1999 check digit.
- Gs1 key validate: Validate a GTIN-8/12/13/14, GLN, SSCC or GSIN's GS1 mod-10 check digit and look up its 3-digit GS1 prefix meaning.
- Isin validate: Validate a 12-character ISIN's ISO 6166 Luhn check digit and parse its country prefix, NSIN and NSIN scheme.