Generator · Polish data
Polish passport number
Endpoint GET /v1/pl/passport
What it covers
Returns a valid Polish passport number (numer paszportu) with a correct checksum. Use `format` to choose between compact and space-separated rendering. Set `invalid=true` to get a passport number with a deliberately wrong check digit, for testing checksum validators.
How it’s calculated
A single decimal check digit sits at position 3 of the nine-character passport number (right after the two series letters); it is chosen so the weighted sum over all nine characters, with letters valued A=10…Z=35, is congruent to 0 modulo 10.
Algorithm
- A Polish passport number has nine characters: two uppercase series letters, then seven digits. Positionally (zero-based) that is [L1, L2, C, d3, d4, d5, d6, d7, d8], where C at index 2 is the check digit and d3..d8 are the six remaining digits.
- Assign each of the nine positions a fixed weight from the vector [7, 3, 9, 1, 7, 3, 1, 7, 3] (index 0 through 8). Note the check position (index 2) carries weight 9.
- Convert each character to a numeric value: an uppercase letter A–Z maps to 10–35 (value = codePoint - codePoint('A') + 10, i.e. A=10, B=11, …, Z=35); a digit 0–9 maps to its own numeric value. Any other character is an error.
- To find the check digit, try each candidate c from 0 to 9. For each candidate, place c at index 2 and compute the weighted sum: sum over all nine positions of weight[index] * characterValue(character at that index).
- The correct check digit is the candidate c for which the weighted sum is congruent to 0 modulo 10. Exactly one such digit exists because the check position's weight (9) is coprime with 10.
- Equivalently and directly: let S = the weighted sum of the eight non-check positions (the two letters and the six trailing digits, using their own weights). Then choose C so that (S + 9*C) mod 10 == 0, i.e. solve 9*C ≡ (-S) mod 10.
- Emit the number as the two series letters, the check digit, then the six trailing digits: e.g. AA C d3 d4 d5 d6 d7 d8 (nine characters total).
Worked example
Passport series AB, trailing digits 123456, check digit ? → AB?123456
Nine-character layout with placeholder at the check position: A, B, C, 1, 2, 3, 4, 5, 6 (indices 0..8).
Weights by index: [7, 3, 9, 1, 7, 3, 1, 7, 3].
Character values: A=10, B=11, then digits 1,2,3,4,5,6 keep their own values.
Weighted contributions of the eight non-check positions: A(10)*7=70; B(11)*3=33; d3=1*1=1; d4=2*7=14; d5=3*3=9; d6=4*1=4; d7=5*7=35; d8=6*3=18.
Sum of non-check contributions S = 70+33+1+14+9+4+35+18 = 184.
Check position weight is 9, so we need (184 + 9*C) mod 10 == 0. Since 184 mod 10 = 4, we need (4 + 9*C) mod 10 == 0, i.e. 9*C ≡ 6 (mod 10).
Scanning C=0..9: C=4 gives 9*4=36 ≡ 6 (mod 10). Total = 184 + 36 = 220, and 220 mod 10 = 0. So C = 4.
No smaller candidate works: C=0→184(4), C=1→193(3), C=2→202(2), C=3→211(1), C=4→220(0) ✓.The check digit is 4, giving the full passport number AB4123456 (compact) or AB 4123456 (with space).
Edge cases
- The check digit is not appended at the end — it is the third character of the nine-character string, immediately after the two series letters (zero-based index 2).
- Both series letters participate in the checksum with their alphabetic values (A=10 … Z=35), not just the digits, so the two leading letters affect the required check digit.
Gotchas
- characterValue throws on any character that is not an uppercase A–Z letter or a single digit, so malformed input fails fast rather than silently producing a wrong sum.
- Because the check position's weight (9) is coprime with 10, exactly one check digit in 0–9 satisfies the mod-10 congruence; the generator finds it by a simple 0–9 scan rather than a closed-form complement.
- The mod-10 rule means the full weighted sum (including the check digit) is ≡ 0 mod 10 — there is no 10-minus-remainder complement step and no residue that maps to a non-digit, so every position is always fillable with a plain 0–9 digit.
Parameters
| Parameter | Type | Description |
|---|---|---|
| count | integer1–1000 | Number of records to return, 1–1000 (your plan may lower this). Omitted returns a single record; set it for a batch. |
| edge | boolean | Restrict output to edge-case passports from the rare corners. |
| extreme | boolean | Return a correct value wrapped in a hostile encoding (untrimmed whitespace, invisible/zero-width characters, BOM, or bidi/combining marks). Homoglyphs are excluded so the value stays machine-parseable; it still validates after normalisation. |
| format | "compact" | "with-space" | Passport-number rendering: compact or with a space. Default compact. |
| invalid | boolean | Return a number with a deliberately wrong check digit. |
| seed | integer | Integer seed for reproducible output: the same seed always yields the same record. |
Response fields
| Field | Type | Description |
|---|---|---|
| value | string | The passport number in the requested format. |
| series | string | The two uppercase series letters, e.g. "AA". |
| number | string | The seven digits including the check digit, e.g. "1234567". |
Other generators for Poland
Polish addressPolish companyPolish company namePolish driving licence numberPolish email addressPolish IBANPolish ID card numberPolish KRS numberPolish land and mortgage register numberPolish NIPPolish personPolish person namePolish PESELPolish product or service offeringPolish REGONPolish vehicle registration plate
See all generators for Poland →The same kind of identifier elsewhere
Austrian data · Austrian FirmenbuchnummerAustrian data · Austrian SteuernummerAustrian data · Austrian UIDBelgian data · Belgian OndernemingsnummerBulgarian data · Bulgarian EIKCzech data · Czech IČODanish data · Danish CVRDutch data · Dutch btw-idDutch data · Dutch KvK numberDutch data · Dutch RSINEstonian data · Estonian KMKREstonian data · Estonian registrikoodFrench data · French SIRENGerman data · German HandelsregisternummerGerman data · German Personalausweis numberGerman data · German USt-IdNrGerman data · German Wirtschafts-IdNrHungarian data · Hungarian adószámHungarian data · Hungarian cégjegyzékszámIrish data · Irish CRO numberIrish data · Irish VAT numberItalian data · Italian Partita IVALatvian data · Latvian registracijas numursLithuanian data · Lithuanian įmonės kodasLithuanian data · Lithuanian PVM (VAT) numberLuxembourg data · Luxembourg TVAMaltese data · Maltese identity card numberMaltese data · Maltese VAT numberPortuguese data · Portuguese Cartão de Cidadão numberRomanian data · Romanian CUI/CIFSlovak data · Slovak IČ DPHSlovak data · Slovak IČOSpanish data · Spanish CIFSwedish data · Swedish organisationsnummer
Try it