Detectors
USt-IdNr
Detect and validate German VAT identification numbers with MOD 11,10 checksum.
Purpose
Use the ust_id detector for German VAT identification numbers (Umsatzsteuer-Identifikationsnummer).
Detector Name
ust_idSupported Formats
DEfollowed by 9 digits:DE136695976
The country prefix DE is required.
Validation Logic
- Strip spaces and uppercase the value.
- Must start with
DEfollowed by exactly 9 digits. - The first digit after
DEmust not be0. - Run the MOD 11,10 checksum on the 9 digits.
Checksum Algorithm (MOD 11,10)
Same as Steuer-ID checksum algorithm applied to the 9 numeric digits after the DE prefix.
- Start with a product of
10. - For each digit position 1-8:
- Add the digit to the product.
- Take
sum % 10. If0, replace with10. - Multiply by
2. - Take
product % 11.
- The 9th digit must equal
(11 - product) % 10.
Python Examples
from fastpii import FastPII, DEFAULT_PRIORITY
from fastpii.countries.de import GermanPack
engine = FastPII(priority=DEFAULT_PRIORITY)
engine.register(GermanPack())
result = engine.detect("USt-IdNr: DE136695976", detector_names=["ust_id"])Validate a value directly
from fastpii import FastPII, DEFAULT_PRIORITY
from fastpii.countries.de import GermanPack
engine = FastPII(priority=DEFAULT_PRIORITY)
engine.register(GermanPack())
result = engine.validate("DE136695976", "ust_id")
print(result.is_valid)Detect in free text
from fastpii import FastPII, DEFAULT_PRIORITY
from fastpii.countries.de import GermanPack
engine = FastPII(priority=DEFAULT_PRIORITY)
engine.register(GermanPack())
result = engine.detect("USt-IdNr: DE136695976")
for finding in result.findings:
print(finding.type, finding.value)Limitations
- USt-IdNr is specific to German VAT identification.
- The
DEprefix is required for detection and validation. - Cross-border EU VAT verification is not performed.