Identifier detector
Finnish HETU: format, validation and detection
Short answer
A Finnish personal identity code (henkilötunnus, HETU) is DDMMYY, a century sign, a three-digit individual number and a check character. The check character is the remainder of the nine digits divided by 31, looked up in 0123456789ABCDEFHJKLMNPRSTUVWXY.
What it is
The HETU identifies people in Finland. Maskflare's Finland pack covers it as a national ID, and the GDPR (EU/EEA) profile includes the pack.
In Maskflare this is the detector fi_hetu, labelled "Finland - Personal identity code (HETU)", category national id number, in the Finland pack.
Format and layout
- 11 characters: six date digits, one century sign, three digits and a check character, for example 131052-308T. The pattern accepts these century signs: - + A B C D E F U V W X Y.
- The date must be valid.
- The final character is a digit or one of the letters A to F, H, J to N, P, R to Y (not G, I, O, Q or Z).
How the check works
Join the six date digits and the three individual digits into a nine-digit number, divide it by 31, and use the remainder as a zero-based index into the string 0123456789ABCDEFHJKLMNPRSTUVWXY.
Worked example
- The nine digits are 131052308.
- 131052308 divided by 31 leaves 25.
- Position 25 in the string (counting from 0) is T, the last character of the example.
Valid and invalid examples
| Example | Result | Why |
|---|---|---|
131052-308T | Valid | Matches the layout and passes the validator. |
131052-308A | Invalid | The invalid example changes one character, the last character: T becomes A. |
In running text the valid example reads, for instance, HETU 131052-308T. The invalid one is left alone: a value that fails the validator is treated as an ordinary string.
Regex and validation caveats
- The validator reads the character as upper case, so a lower-case final letter is accepted.
- One in 31 random combinations passes the check character; with the date rule the combined filter is stronger.
- No context words are needed; the century sign and the check letter make the shape specific.
How to detect it in LLM traffic
Finnish HETU 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 Finnish HETU 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.
- 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 Finland is a primary country.
- Monitor first: alert (counted, forwarded unchanged) when Finland 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 Finland pack, and applying it turns this detector on: GDPR - EU/EEA. For the GDPR (EU/EEA) profile the Finland 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
What is the HETU check character?
The remainder when the nine-digit number (date plus individual number) is divided by 31, mapped into 0123456789ABCDEFHJKLMNPRSTUVWXY.
Why are some letters missing from the check string?
The string leaves out G, I, O, Q and Z. Maskflare's validator uses that exact string.
Is the Finnish HETU detector on by default?
It depends on the organisation's primary countries. It is part of the Finland pack, which the default Protect now template turns on with the action mask when Finland is a primary country.
Does a valid Finnish HETU 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.