skillfed

python-codicefiscale

encode / decode italian fiscal codes - codifica / decodifica del Codice Fiscale italiano.

python-codicefiscale v0.12.1 102.9K downloads/30d#12,837 on PyPI89
Permissive 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) Active released

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 on this page — 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

python-codicefiscale on PyPI

pip

pip install python-codicefiscale

uv

uv add python-codicefiscale

poetry

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 not specified
Install friction low — pure-Python wheel
Runtime dependencies 3 — python-dateutil, python-fsutil, python-slugify
Maintenance actively maintained — 98 days since the last release
Last repo commit
First released
Downloads 102,908/month — #12,837 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: python_codicefiscale-0.12.1-py3-none-any.whl

Keywords: codicefiscale, codice, fiscale, cf, fiscal code, italia, italy

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Build Tools

Tags

italian fiscal code encoder decodercodice fiscale python libraryitalian tax id generatorfiscal code validationcodice fiscale encode decodeitalian personal tax codecf code generator italy
italian-identityfiscal-codedata-validation

More Build Tools packages