FastPII Docs
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_id

Supported Formats

  • DE followed by 9 digits: DE136695976

The country prefix DE is required.

Validation Logic

  1. Strip spaces and uppercase the value.
  2. Must start with DE followed by exactly 9 digits.
  3. The first digit after DE must not be 0.
  4. 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.

  1. Start with a product of 10.
  2. For each digit position 1-8:
    • Add the digit to the product.
    • Take sum % 10. If 0, replace with 10.
    • Multiply by 2.
    • Take product % 11.
  3. The 9th digit must equal (11 - product) % 10.

Python Examples

from fastpii import FastPII
from fastpii.countries.de import GermanPack

priority = {"ust_id": 95, "steuer_id": 100, "email": 70, "name": 50}
engine = FastPII(priority=priority)
engine.register(GermanPack())
result = engine.detect("USt-IdNr: DE136695976", detector_names=["ust_id"])

Convenience API

from fastpii import PrivacyGuard

guard = PrivacyGuard(regions=["de"])
result = guard.validate("DE136695976", "ust_id")

print(result.is_valid)

Convenience API — Detect in free text

from fastpii import PrivacyGuard

guard = PrivacyGuard(regions=["de"])
result = guard.detect("USt-IdNr: DE136695976")

for finding in result.findings:
    print(finding.type, finding.value)

Limitations

  • USt-IdNr is specific to German VAT identification.
  • The DE prefix is required for detection and validation.
  • Cross-border EU VAT verification is not performed.

On this page