Identifier detector
Polish PESEL: format, validation and detection
Short answer
A Polish PESEL has 11 digits: a birth date with the century encoded in the month, a serial number with a sex digit, and a check digit using the weights 1, 3, 7, 9 repeated.
What it is
PESEL is the Polish national identification number. Maskflare's Poland pack covers it, filed as a national ID and described as also being social security, and the GDPR (EU/EEA) profile includes the pack.
In Maskflare this is the detector pl_pesel, labelled "Poland - PESEL (also social security)", category national id number, in the Poland pack.
Format and layout
- 11 digits with no separators.
- Digits 1 to 6 are the birth date: YYMMDD, where the month carries the century (add 20 for 2000s, 40 for 2100s, 60 for 2200s, 80 for 1800s).
- The date must be a real date. All digits cannot be the same.
- The eleventh digit is the check digit.
How the check works
Multiply the first ten digits by 1, 3, 7, 9, 1, 3, 7, 9, 1, 3 and add them up. The check digit is 10 minus the last digit of the total, with 10 read as 0.
Worked example
- Digits 4 4 0 5 1 4 0 1 3 5 with weights 1 3 7 9 1 3 7 9 1 3 give 4, 12, 0, 45, 1, 12, 0, 9, 3, 15.
- The total is 101; its last digit is 1.
- 10 minus 1 is 9, the last digit of the example.
Valid and invalid examples
| Example | Result | Why |
|---|---|---|
44051401359 | Valid | Matches the layout and passes the validator. |
44051401350 | Invalid | The invalid example changes one character, the last character: 9 becomes 0. |
In running text the valid example reads, for instance, PESEL 44051401359. The invalid one is left alone: a value that fails the validator is treated as an ordinary string.
Regex and validation caveats
- An 11-digit run is masked unless a word like order or invoice sits closer to it than one of the detector's keywords (id no, id number, identity number).
- The date rule rejects many random numbers before the check digit is reached.
- A PESEL reveals birth date and sex, so even a partial leak is sensitive.
Words that confirm it
The formatted shape is masked without a keyword. For a run with no separators, these words count as the detector's own keywords when a word like order, invoice or phone is also close: id no, id number, identity number, national id, personal id, personal number, pesel. The nearer word wins.
How to detect it in LLM traffic
Polish PESEL values reach an LLM inside ordinary work rather than as standalone data: a pasted block of HR or payroll rows, a customer-support thread, an onboarding or identity-check form, a spreadsheet someone wants summarised, or an email they want rewritten. The model needs none of the digits for any of those jobs, so the safest place to remove them is before the request leaves the company.
Maskflare reads the whole request body, including the system prompt, earlier messages and tool arguments, so a number buried in the fourth message of a long chat is found as readily as one in the latest message. Each match is replaced with a token such as mf_mask_d7e0 before the request goes out, and with response restoration turned on the real value is put back into the answer for the person who is allowed to see it.
If you build the detection yourself
- Strip spaces, dots and hyphens before running any arithmetic, but remember where they were so the original text can be replaced exactly.
- Match the shape with a pattern anchored on word boundaries, so that a long digit string is not read as several shorter Polish PESEL candidates.
- Run the check from the section above. A failing check is almost always a typo or a made-up value; a passing one removes most look-alikes.
- Treat a run with no separators more carefully than a formatted one: reject it when a word such as order, invoice, phone or reference is nearer to it than one of the identifier's own keywords.
- Replace the value before the text is sent anywhere, and keep a mapping if the answer has to be restored afterwards.
How Maskflare handles it
- Protect now, Finance - Protect now, Healthcare and Developer: mask (a reversible token) when Poland is a primary country.
- Monitor first: alert (counted, forwarded unchanged) when Poland is a primary country.
The available actions are mask (reversible token), redact, partial, hash, format-preserving encryption, generalize, alert and block. Masked values are kept encrypted for 30 days so that answers can be restored, then they expire; prompts and responses are not logged. The full list of detectors is in the detector reference.
Compliance profiles that include it
One compliance profile includes the Poland pack, and applying it turns this detector on: GDPR - EU/EEA. For the GDPR (EU/EEA) profile the Poland pack is one of the country packs the administrator can choose from; the profile turns on the ones chosen. A profile is a floor: it never turns anything off or weakens a rule that is already stricter.
Frequently asked questions
How is the century encoded in PESEL?
In the month digits: 01 to 12 for the 1900s, 21 to 32 for the 2000s, 41 to 52 for the 2100s, 61 to 72 for the 2200s and 81 to 92 for the 1800s.
How is the PESEL check digit computed?
Weight the first ten digits 1, 3, 7, 9 repeating, sum them, and subtract the last digit of the sum from 10 (10 becomes 0).
Is the Polish PESEL detector on by default?
It depends on the organisation's primary countries. It is part of the Poland pack, which the default Protect now template turns on with the action mask when Poland is a primary country.
Does a valid Polish PESEL prove the person exists?
No. A check digit shows the value is well formed. Many valid-looking numbers have never been issued, and Maskflare masks them all the same.
Rules on this page describe what Maskflare's detectors and validators check. They are read from the detection catalogue and are not the specification of the body that issues the identifier. Examples are synthetic.