NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #4021 most downloaded on PyPI
IBAN parsing and validation
Last release 2 months ago
23 Jul 2026
Ships fairly regularly
a new release about every 2 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
91 releases · first in 2016
BBAN.random now constructs a valid national checksum instead of repeatedly generating random BBANs until one happens to validate. Each checksum algori
BBAN.random now constructs a valid national checksum instead of repeatedly generating random BBANs until one happens to validate. Each checksum algorithm can now solve the components it is responsible for: the German methods splice a valid check digit into the account code, Iceland fixes its embedded check digit, and the Czech and Slovak methods adjust the account and branch codes to satisfy their mod-11 constraints. As a result random BBANs are produced on the first attempt for effectively every country and bank, rather than after up to 2000 brute-force retries.Dict-style access (subscription and .get()) on the objects returned by IBAN.spec / IBAN.bank (and their BBAN counterparts) is deprecated and now emits…
IBANSpec and Bank) instead of raw dictionaries. Bank now also carries the checksum_algo field that selects the national checksum method.IBANSpec and Bank, supporting subscription and get() lookups, to maintain backward compatibility for public attributes like IBAN.spec and IBAN.bank..get()) on the objects returned by IBAN.spec / IBAN.bank (and their BBAN counterparts) is deprecated and now emits a DeprecationWarning. Use attribute access instead, e.g. bank.name instead of bank["name"].schwifty.registry.get, schwifty.registry.has and schwifty.registry.save. These were never part of the advertised public interface, but if you relied on them, use the typed query functions instead: get_iban_spec, get_banks_by_country, get_banks_by_code, get_banks_by_bic, get_countries and the new get_all_banks.validate_bban=True. The per-bank checksum_algo was dropped during the switch to typed registry objects, so BBAN.validate_national_checksum always resolved to a non-existent DE:default algorithm and returned successfully without checking. The account-code checksum is now validated again for German banks.0. Algorithm11.reconcile returned the raw value 11 for these accounts instead of mapping it to 0 like the base method 06/10 do, so validate compared against the impossible two-digit check digit "11" @chuenchen309.GENODEM1@#%) was accepted and even exposed the garbage through BIC.branch_code @gaoflow.16. It was computed over account positions 6-9 (copied from method 15), but per the Bundesbank specification method 16 is computed like method 06 over positions 1-9; only method 15 is restricted to positions 6-9. Valid IBANs for banks using method 16 (e.g. Hanseatic Bank) were wrongly rejected.08 threshold. Per the Bundesbank specification the check digit is only applied from account number 60000 upward, but the threshold was set to 6000. Accounts in the [6000, 60000) range for banks using method 08 (e.g. NRW.BANK, Helaba) were wrongly rejected. @chuenchen309One column per quarter.
Reverted changes to Italian bank registry due to invalid bank codes being added.
Added Yemen (YE) to the IBAN registry so Yemeni IBANs can be parsed and validated (#294) @CedricConday.
Added bank registry for Moldova (MD) with 10 commercial banks @Mihaileahu17
uv to manage Python versions instead of flox.Removed support for deprecated Python version 3.9
Removed support for deprecated Python version 3.9
Updated local bank registries
Adding Revolut Bank UAB @bitshift.
Fix Modulr Finance @bitshift.
Added bank registry for Liechtenstein.
Allow lax validation of IBAN values when used with Pydantic ```python from typing import Annotated from typing import Field from pydantic import BaseM
from typing import Annotated
from typing import Field
from pydantic import BaseModel
class Model(BaseModel):
iban: Annotated[IBAN, Field(strict=False)]
Allow lax validation of IBAN values when used with Pydantic
from typing import Annotated
from typing import Field
from pydantic import BaseModel
class Model(BaseModel):
iban: Annotated[IBAN, Field(strict=False)]
Updated bank registry for Germany, Autstria, Switzerland and Poland.
Fixed script populating the Italian bank registry, adding over 150 additional banks (thanks to @ciotto)
Allow country specific components to be passed to IBAN.generate(). ```pycon
IBAN.generate().>>> IBAN.generate("IS", bank_code="0101", account_type="26", account_code="85002", account_holder_id="5402696029")
<IBAN=IS910101260850025402696029>
Allow country specific components to be passed to IBAN.generate().
>>> IBAN.generate("IS", bank_code="0101", account_type="26", account_code="85002", account_holder_id="5402696029")
<IBAN=IS910101260850025402696029>
Update the bank registries for Austria, Germany and Switzerland
Removed support for deprecated Python version 3.8
Fix Python 3.8 support while it is still supported (EOL is 2024-10) (thanks to @bwoodsend)
Allow BIC and IBAN objects to be deepcopied (thanks to @binaryDiv for pointing this out).
BIC and IBAN objects to be deepcopied (thanks to @binaryDiv for pointing this out).Added French Polynesian banks to the registry @tut-tuuut
The BIC.from_bank_code now handles banks correctly that have no value for the BIC field in the registry.
BIC.from_bank_code now handles banks correctly that have no value for the BIC field in the registry.hatch fmt and hatch test commands for internal development.Stop using the “elfprooef” algorithm when validating Dutch IBANs, since the administrative authority says it should not be checked anymore. See #205 f
The IBAN and BBAN classes now have an additional property currency_code for countries like Seychelles, Guatemala, or Mauritius.
IBAN and BBAN classes now have an additional property currency_code for countries like Seychelles, Guatemala, or Mauritius.primary-flag set, even though an appropriate mapping was available.IBAN.random() now also works for countries which have a currency code included in their BBAN e.g., Mauritius or Seychelles. #206 (thanks to @noamshalev for reporting).IBAN.random() now also works for aspirational countries, where no information of the BBAN structure is available, e.g., Comoros. #206There is a new classmethod IBAN.random() that allows you to create random, but valid IBANs 🎉 . ```pycon
IBAN.random() that allows you to create random, but valid IBANs 🎉 .>>> IBAN.random()
<IBAN=LT435012771675726758>
You can narrow down the generated values by providing the corresponding parameters to this function. E.g., to get only Spanish IBANs you can do>>> IBAN.random(country_code="ES")
<IBAN=ES8801253179194914182449>
There is a new classmethod IBAN.random() that allows you to create random, but valid IBANs.
>>> IBAN.random()
<IBAN=LT435012771675726758>
You can narrow down the generated values by providing the corresponding parameters to this function. E.g. to get only Spanish IBANs you can do
>>> IBAN.random(country_code="ES")
<IBAN=ES8801253179194914182449>
Some missing bank associations have been added to the Portoguese bank registry by @tiagoafseixas
Re-add typing-extensions as explicit dependency for Python < 3.11 to support the Self type. This was accidentally removed in https://github.com/mdomke
typing-extensions as explicit dependency for Python < 3.11 to support the Self type. This was accidentally removed in https://github.com/mdomke/schwifty/commit/aa251c25c3439d5c2de476f444f5be7467ea866bRemove custom collection logic of the bank registry for pyinstaller. The changes introduced in #92 were wrong and have been reverted. Usage example `
$ pyinstaller <script> --collect-data schwifty --copy-metadata schwifty
Remove custom collection logic of the bank registry for pyinstaller. The changes introduced in #92 were wrong and have been reverted. Usage example
$ pyinstaller <script> --collect-data schwifty --copy-metadata schwifty
Loading JSON data into a Pydantic model with an IBAN or BIC-field (Model.model_validate_json()) was previously broken and has been fixed now.
iso3166 since its functionality is already covered by pycountry (suggested by @sergei-maertens)Loading JSON data into a Pydantic model with an IBAN or BIC-field (Model.model_validate_json()) was previously broken and has been fixed now.
JSON schema generation for Pydantic models.
Updated bank registries.
Remove the dependency to iso3166 since its functionallity is already covered by pycountry
Added Revolut Bank for Spain @brunovilla
BBAN structure. As a result, some entries had to be removed, because they did contain invalid bank codes.Support aspirational countries:
Support aspirational countries:
National checksum algorithms for many countries have been added:
Add new banks to the list of French banks @Natim :
New IBAN.in_sepa_zone-property to indicate if the IBAN's country is part of the SEPA
zone.
New manual bank registries for
New attributes IBAN.account_id, IBAN.account_holder_id and
IBAN.account_type that are available depending on the country's BBAN specification.
E.g. IBAN.account_holder_id is currently only available for Iceland (Kennitala) and only
Brazil defines an IBAN.account_id.
IBAN-class now has an additional IBAN.bban-attribute, where all country
specific functionality has been moved to.Add OKALI to the list of French banks @Natim.
The Swiss bank registry is now generated from the SIX Group #167
The Swiss bank registry is now generated from the SIX Group.
The Swiss bank registry is now generated from the SIX Group.
Manually add missing bank entry for Spain.
Updated bank registr for Austria and Poland.
The validation of a BIC is now performed in the context of ISO 9362:2022 which allows numbers in the business party prefix. If strict SWIFT compliance
enforce_swift_compliance parameter can be set to True.The Pydantic v2 protocol is now supported, so that the IBAN and BIC classes can be directly used as type annotations in Pydantic models
IBAN and BIC classes can be directly used as type annotations in Pydantic modelsIBAN and BIC classes are now subclasses of str so that all string related methods and functionalities (e.g. slicing) are directly available.Support for Python 3.7 has been dropped.
BIC.candidates_from_bank_code to list all matching BICs to a given domestic bank code @NatimFor Ukrainian banks calling iban.bic did result in a TypeError. Thanks, @bernoreitsma, for reporting.
iban.bic did result in a TypeError. Thanks, @bernoreitsma, for reporting.Updated generated bank registries for Austria, Belgium, Germany, Netherlands, Hungary, Slovenia and Ukraine.
The domestic checksum calculation for Belgium now returns 97 in case the modulo operation results in 0. @mhemeryck
New banks for Portugal and Italy @dennisxtria _
New banks for Portugal and Italy @dennisxtria
Added support for Ukrainian banks @shpigunov
Corrected bank codes for Cypriot banks @Krystofee
IBAN validation for Senegal @mkopec87
In some countries the BBAN does not include a bank code, but only a branch code (e.g. Poland). In those cases, the branch code should be used to look
Hungarian bank registry generator script was fixed by @Krystofee
Generated list of Lithuanian BICs @Draugelis
Generated list of Greek BICs @kounabi
Generated list of Romanian BICs @Krystofee
Manually curated list of Bulgarian BICs @Krystofee
setup.cfg @adamchainzhacking in test-setup @adamchainzAllow getting bank names from IBAN. Previously, you could do iban.bic.bank_names[0], but since a BIC can be associated to multiple bank codes the cont
iban.bic.bank_names[0], but since
a BIC can be associated to multiple bank codes the context of the specific bank is lost and you
could end up with the wrong bank name. @jose-reveniThe Italian BBAN checksum algorithm is now also applied for San Marino @fabienpe
Update bank registry for Austria, Czech Republic, Germany, Spain, Poland and Slovakia.
Country specific checksum validation for French banks (based on the work of @sholan)
Country specifc checksum validation for French banks (based on the work of @sholan)
The IBAN and BIC classes now support the __len__ method to allow a more Pythonic calculation of the length.
IBAN and BIC classes now support the __len__ method to allow a more Pythonic calculation of the length.Manually curated entries for banks from Iceland @gautinils
Added 440 additional bank records for Spain.
Use importlib.resources for loading internal registries. This removes the need to have setuptools installed. Thank you @a-recknagel for the idea!
setuptools installed.
Thank you @a-recknagel for the idea!Added IBAN spec for Sudan (SD).
schwifty to be installed for Python versions older than 3.7. It was unsupported
before, but is now rejected upon installation with an appropriate error message.Enable tool based type checking as described in PEP-0561 by adding the py.typed marker @jmfederico
py.typed marker @jmfedericoAdded bank registry for Swedish banks (thanks @jmfederico)
Country specifc checksum validation for Belgian banks, as well as support for generating the checksum when using the IBAN.generate()-method. (thanks @
The IBAN validation now optionally includes the verification of the country-specific checksum within the BBAN. This currently works for German and Ita
Added manually curated list of Lithuanian Banks (e.g Revolut Payments UAB).
Added type hints to the entire code base.
Restructure documentation and change theme to furo
Restructure documentation and change theme to furo.
Added dedicated exception classes for various validation errors.
Drop support for Python 2. Only Python 3.6+ will be supported from now on.
Use PEP 517/518 compliant build setup.
Updated IBAN registry and bank registries of Poland, Germany, Austria, Belgium, Netherlands, Czech Republic and Slovenia.
Updated IBAN registry and bank registries of Poland, Germany, Austria, Belgium, Netherlands, Czech Republic and Slovenia.
Added generated banks for Slovakia @petrboros.
Added a test to validate the correctnes of BICs in the registry @ckoehn.
Fixed encoding for Polish bank registry @michal-michalak.
Added support for dutch banks 🎉 [@insensitiveclod ]
Migrated build and test pipelines to GitHub actions.
Added generated banks for Netherlands @insensitiveclod.
Added generated banks for Spain.
Fix IBAN generation for countries with branch code
Fixed IBAN generation for countries with branch/sort code
Add generated banks for Spain
Fix BIC derivation for PL and HR
Poland's IBAN spec only has a branch-code but no bank-code
Fixed listing of supported countries for BIC derivation.
Fixed bank registry for Hungary.
Updated bank registry Poland, Belgium and Austria.
Updated IBAN spec for Sao Tome and Principe
Your coding agent can read these notes before it upgrades. Set up the MCP server →