Detectors
NIP
Detect and validate Polish tax identification numbers with weighted Mod 11 checksum.
Purpose
Use the nip detector for Polish tax identification numbers (NIP — Numer Identyfikacji Podatkowej).
Detector Name
nipSupported Formats
- 10 digits:
NNNNNNNNNN - With dashes:
NNN-NNN-NN-NN
FastPII strips dashes before validation.
Validation Logic
- Remove dashes and spaces.
- Require exactly 10 digits.
- Run the weighted Mod 11 checksum.
Checksum Algorithm
- Multiply each digit by weights
[6, 5, 7, 2, 3, 4, 5, 6, 7](first 9 digits). - Sum the products.
- Take
sum % 11. - Compare the result with the 10th digit.
Python Examples
Explicit Engine (Recommended)
from fastpii import FastPII
from fastpii.countries.pl import PolishPack
priority = {"nip": 95, "pesel": 100, "email": 70, "name": 50}
engine = FastPII(priority=priority)
engine.register(PolishPack())
result = engine.detect("NIP: 5260250274", detector_names=["nip"])Convenience API
from fastpii import PrivacyGuard
guard = PrivacyGuard(regions=["pl"])
result = guard.validate("5260250274", "nip")
print(result.is_valid)Convenience API — Detect in free text
from fastpii import PrivacyGuard
guard = PrivacyGuard(regions=["pl"])
result = guard.detect("NIP: 5260250274")
for finding in result.findings:
print(finding.type, finding.value)Limitations
- NIP is specific to Polish tax identification.
- The detector relies on context words or explicit formatting to avoid false positives on other 10-digit numbers.