--- id: python-codicefiscale version: "0.12.1" license: MIT License Copyright (c) 2017-present Fabio Caccamo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),… (full text in the JSON record) license_treatment: permissive maintenance: active --- # python-codicefiscale — encode / decode italian fiscal codes - codifica / decodifica del Codice Fiscale italiano. License: permissive · Maintenance: active · Downloads: 102.9K/mo ## What it is and what it does python-codicefiscale is a library for encoding and decoding Italian fiscal codes (Codice Fiscale), the unique personal tax identifier used in Italy. It takes personal information—name, surname, gender, birthdate, and birthplace—and generates the corresponding fiscal code, or reverses the process to extract demographic data from an existing code. The library handles multiple birthdate formats, automatically detects Italian city and foreign country codes, and supports omocodia (alternative valid representations of the same code). The package includes both a Python API and a command-line interface. It depends on python-dateutil for date handling, python-fsutil for file operations, and python-slugify for text normalization. Data is auto-updated weekly from ANPR (the Italian national registry), and the library can suggest possible first names from encoded codes—achieving near-certain identification in approximately 60% of Italian cases. It is actively maintained, supports Python 3.10 through 3.14, and carries no known security vulnerabilities. Use it for: - Generate fiscal codes for Italian citizens during user registration or identity verification workflows - Validate or decode existing fiscal codes to extract and verify demographic information - Batch-process fiscal codes in administrative or tax-related applications - Integrate fiscal code handling into Italian e-government or compliance systems - Resolve ambiguous name encodings by retrieving possible first-name candidates from a code ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Encodes and decodes Italian fiscal codes (Codice Fiscale), with support for validation, omocodia detection, and automatic birthplace lookup from Italian and foreign locations. Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, and is licensed under MIT. Install it if you need to work with Italian fiscal codes in Python—whether for encoding, decoding, validation, or integration into Italian administrative systems. ## Install pip install python-codicefiscale uv add python-codicefiscale poetry add python-codicefiscale ## Installing python-codicefiscale Before you install: Low friction install with three lightweight runtime dependencies (python-dateutil, python-fsutil, python-slugify). Active maintenance with a recent release and ongoing repository activity. License in practice: MIT License permits unrestricted use, modification, and distribution with minimal restrictions—suitable for commercial and open-source projects alike. Quickstart: pip install python-codicefiscale from codicefiscale import codicefiscale # Encode code = codicefiscale.encode( lastname="Caccamo", firstname="Fabio", gender="M", birthdate="03/04/1985", birthplace="Torino" ) # Decode result = codicefiscale.decode(code) # Validate is_valid = codicefiscale.is_valid(code) Verify before relying: - Whether ANPR data updates occur reliably once per week as described - Accuracy of the ~60% single-name-match rate for Italian birthplaces in real-world use - Performance characteristics when processing large batches of codes ## Package facts - License: MIT License Copyright (c) 2017-present Fabio Caccamo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),… (full text in the JSON record) (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 102.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags italian fiscal code encoder decoder, codice fiscale python library, italian tax id generator, fiscal code validation, codice fiscale encode decode, italian personal tax code, cf code generator italy, italian-identity, fiscal-code, data-validation [View on SkillFed](https://skillfed.io/packages/python-codicefiscale) · [View on PyPI](https://pypi.org/project/python-codicefiscale/)