Guide
How to calculate the codice fiscale: step-by-step guide
By Codice Fiscale Pro Team · Published on
What is a codice fiscale made of?
The codice fiscale is an alphanumeric code of 16 characters that identifies a person for tax purposes in Italy. The rules for building it come from a decree of the Italian Ministry of Finance dated 23 December 1976, as Pmi.it (in Italian) recalls. The table shows the seven parts using the example BRWJHN85S03Z404I.
| Positions | Content | Example |
|---|---|---|
| 1-3 | Surname | BRW |
| 4-6 | First name | JHN |
| 7-8 | Year of birth (last two digits) | 85 |
| 9 | Month of birth | S |
| 10-11 | Day of birth and sex | 03 |
| 12-15 | Municipality or foreign country of birth | Z404 |
| 16 | Check character | I |
How are the three surname letters worked out?
Take the first three consonants of the surname in order. If there are fewer than three consonants, add the vowels, again in order. If letters are still missing, fill with X.
| Surname | Letters used | Result |
|---|---|---|
| Smith | S, M, T | SMT |
| Brown | B, R, W | BRW |
| Müller | M, L, L (the ü counts as u) | MLL |
| Fo | F, then the vowel O, then X | FOX |
| Ai | no consonant: A, I, then X | AIX |
How are the three first-name letters worked out?
If the first name has four or more consonants, take the first, the third and the fourth. With three consonants or fewer, use the same rule as for the surname: consonants, then vowels, then X.
| First name | Consonants | Result |
|---|---|---|
| John | J, H, N (three) | JHN |
| Christopher | C, H, R, S, T, P, H, R: 1st, 3rd and 4th | CRS |
| Emily | M, L, Y (three; the I is a vowel) | MLY |
| Ann | N, N (two), then the vowel A | NNA |
| Jo | J, then the vowel O, then X | JOX |
How are the date of birth and sex written?
Write the last two digits of the year, a letter for the month and the day on two digits. For women, add 40 to the day. A man born on 3 November 1985 gets 85S03. A woman born on 14 April 1992 gets 92D54.
| Month | Letter | Month | Letter |
|---|---|---|---|
| January | A | July | L |
| February | B | August | M |
| March | C | September | P |
| April | D | October | R |
| May | E | November | S |
| June | H | December | T |
The code holds only two digits of the year, so the century cannot be read back from it. The decoder shows every date that fits.
How do you find the code for the place of birth?
The place is written with its Belfiore code: one letter and three digits. Rome is H501 and Milan F205. Foreign countries use codes that start with Z: the United States is Z404, the United Kingdom Z114, Ireland Z116, Canada Z401, Australia Z700 and India Z222.
In the calculator you can type the name of the country or city in English, and the code is filled in for you. One detail we checked while working on the data: in the Agenzia delle Entrate municipality archive (in Italian) the correct code sits in the column "Codice Nazionale". The column "Codice Catastale" holds a different code (for Rome M1AA) and would produce wrong results. See the Belfiore code guide.
How is the check character calculated?
The sixteenth character is a letter from A to Z. You get it by adding up values for the first 15 characters, using one table for odd positions and one for even positions, and turning the remainder of a division by 26 into a letter.
- Convert each character to a number. In even positions a digit is worth itself and a letter is worth its place in the alphabet, starting with A = 0. In odd positions use the table below.
- Add all the values.
- Divide the total by 26 and keep the remainder.
- Turn the remainder into a letter: 0 is A, 1 is B, and so on up to 25, which is Z.
Values for odd positions (1, 3, 5, ... 15)
- Digits 0 to 9: 1, 0, 5, 7, 9, 13, 15, 17, 19, 21.
- Letters A to J: the same values as the digits 0 to 9, in the same order.
- Letters K to Z: 2, 4, 18, 20, 11, 3, 6, 8, 12, 14, 16, 10, 22, 25, 24, 23.
Worked example: BRWJHN85S03Z404
- Odd positions: B = 0, W = 22, H = 17, 8 = 19, S = 12, 3 = 7, 4 = 9, 4 = 9. Sum 95.
- Even positions: R = 17, J = 9, N = 13, 5 = 5, 0 = 0, Z = 25, 0 = 0. Sum 69.
- Total 164. 164 divided by 26 is 6 with remainder 8. Value 8 is the letter I.
The full code is BRWJHN85S03Z404I. John Brown is an example person.
How are accents, apostrophes, spaces and compound names handled?
Only the letters of the alphabet count. Accents, apostrophes, spaces and hyphens are ignored, and accented letters count as the base letter. The exceptions follow the transliteration table of the Italian Ministry of the Interior, used in the Agenzia delle Entrate circular 34/2011: ä and æ count as AE, ö and œ as OE, ü as UE, and ß as SS. Consonants and vowels are counted across the whole surname or first name: O'Connor as a surname gives CNN, and Hans-Peter as a first name gives HSP. A letter such as the umlaut is read as its base letter; since adding an "e" would only add a vowel, the result is usually the same.
For married women the surname at birth is used, not the spouse's. If your name is spelled differently on your passport and your birth certificate, the official code can differ from the calculated one.
Is the calculated code always the official one?
No. The result can differ in cases of omocodia, names recorded in a different spelling, birth abroad or personal data corrected later. The only valid code is the one issued by the Agenzia delle Entrate. Compare it with your health card or use the Agenzia's verification service (in Italian). Our formal check tests structure and the check letter only. For omocodia see what is omocodia.
How do we check our own calculation?
The calculation engine is covered by automated tests and compared with an open source reference library. We compared the codes of 7,886 municipalities in our list without finding a difference, and we recomputed the check letter of the example above with a separate program.
There are two limits. The place list comes from an Agenzia delle Entrate export of current municipalities and countries, so suppressed municipalities are missing. And a calculation cannot know whether a person was given an omocodia code.
Sources
- Pmi.it (Italian): algorithm and the 1976 decree.
- Agenzia delle Entrate (Italian): archive of municipalities and foreign countries.
- Agenzia delle Entrate (Italian): official verification service.
Frequently asked questions
Can I calculate a codice fiscale by hand?
Yes. You need the surname, first name, date of birth, sex and the code of the municipality or country of birth. You work out the letters for surname and first name, write the date and sex, add the place code and compute the check letter with the two conversion tables.
How many characters does a codice fiscale have?
A codice fiscale for a person has 16 characters: 6 letters from surname and first name, 5 characters for date and sex, 4 for the place and 1 check letter.
Why is 40 added to the day of birth for women?
Positions 10 and 11 hold both the day and the sex. For men they show the day from 01 to 31, for women the day plus 40, so from 41 to 71.
What happens if the surname has fewer than three letters?
The letter X fills the gap until there are three characters. The surname Fo gives FOX.
Related guides
- What Is the Codice Fiscale and How Does It Work? | Codice Fiscale Pro: Definition, who assigns it, what it is used for and how it is built.
- What Is Omocodia in the Codice Fiscale? | Codice Fiscale Pro: Why two people can share a code and how its digits change into letters.
- Belfiore Code: What It Is and How to Find It | Codice Fiscale Pro: The place-of-birth code for municipalities and countries, with real examples.
- Common Codice Fiscale Mistakes and How to Avoid Them | Codice Fiscale Pro: The most frequent mistakes in hand calculation and online tools.