This is one of my first projects developed using Python and, notably, with the assistance of Claude. It served as a way to test both the language itself and the capabilities of AI collaboration tools. The motivation behind it is personal: I still haven't memorized my Italian Fiscal Code, so I figured it would be better to learn its logic through code rather than just rote memorization.
✓ Modern, minimal design
✓ Real-time validation
✓ Detailed code breakdown
✓ Responsive interface
✓ Fast and lightweight
The Italian fiscal code is a 16-character alphanumeric code used to uniquely identify citizens for tax and administrative purposes. It's been in use since 1973.
The fiscal code is generated from:
- Surname → First 3 consonants (or consonants + vowels if fewer)
- First Name → 1st, 3rd, and 4th consonants (or first 3 available)
- Birth Year → Last 2 digits
- Birth Month → Letter (A-T mapping to Jan-Dec)
- Birth Day → Day number (+40 for females to distinguish gender)
- Municipality Code → 4-character code
- Check Digit → Calculated based on algorithm
python fiscalcode.pyFollow the prompts to enter your information.
python gui.pyA modern window will open with an easy-to-use form.
python app.pyOpen your browser to http://localhost:5000
- Python 3.7+
flask(for web version only - optional)
# Clone the repository
git clone <repository-url>
cd FiscalCode
# Install optional dependencies (for web version)
pip install flaskInput:
- Surname: Rossi
- First Name: Mario
- Date of Birth: 01/01/1980
- Gender: M
- Municipality Code: H501
Output:
RSSMRA80A01H501C
Breakdown:
- RSS = Rossi (consonants)
- MRA = Mario (1st, 3rd, 4th consonant)
- 80 = 1980
- A = January
- 01 = Day 1
- H501 = Municipality code
- C = Check digit
FiscalCode/
├── fiscalcode.py # Core fiscal code generator
├── gui.py # Desktop GUI application
├── app.py # Web application (Flask)
└── README.md # This file
- Municipality codes are 4-character alphanumeric codes specific to Italian cities
- For females, 40 is added to the day of birth (e.g., day 12 becomes 52 for females)
- The check digit is calculated using a specific algorithm with odd/even position mapping
MIT License - Feel free to use and modify!
Contributions are welcome! Please feel free to submit pull requests.