Skip to content

Identifier detector

Polish PESEL: format, validation and detection

Updated Polandnational ID numberDetector key pl_pesel

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

  1. 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.
  2. The total is 101; its last digit is 1.
  3. 10 minus 1 is 9, the last digit of the example.

Valid and invalid examples

Synthetic values. Each was run through Maskflare's own validator and pattern when this page was generated.
ExampleResultWhy
44051401359ValidMatches the layout and passes the validator.
44051401350InvalidThe 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

  1. Strip spaces, dots and hyphens before running any arithmetic, but remember where they were so the original text can be replaced exactly.
  2. 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.
  3. 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.
  4. 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.
  5. 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.

Related pages

See it on your own data

Try Maskflare free.
Bring your hardest prompts.

28-day free trial or 10,000 requests, whichever comes first. Point one app at the gateway or enroll a few laptops,
and watch what gets masked. Or talk to us first.