ID Numbers and Phone Numbers by Country: What a Tool Should Know
Every country issues identifiers with its own grammar. A tool that treats all digits as one class either misses real IDs or drowns you in false positives on order numbers and times.
Check digits are the dividing line
Singapore NRIC/FIN ends in a letter computed from the seven
digits and a prefix table (S, T, F, G, M — each with its own weights). A masking
tool that checks that letter rejects nearly all random 7-digit strings, which is
why S1234567D is found and S1234567Z is reported as
"not an NRIC".
India Aadhaar uses the Verhoeff algorithm — a permutation-based check stronger than Luhn, designed exactly for human-entry mistakes. Brazil CPF uses mod-11 with two check digits. UK NINO is a two-letter prefix from a defined alphabet, six digits, a final A–D: shape first, then the alphabet.
Phone numbers are also per-country
A Singapore mobile starts [6,8,9] and is 8 digits. A UK mobile is
07 and 10 digits. US numbers are 10 digits in (XXX)
XXX-XXXX. India uses +91 and 10 digits. PII Shield ships all
of these shapes and keeps the generic international form as a fallback — so an
unlisted country still gets masked, just with lower confidence. Findings carry a
confidence score so you can tell a checksum-verified ID from a shape guess.
Context matters as much as format
9123 4567 next to the literal word "Phone" is a phone number;
9123 4567 beside "Invoice" is a reference. PII Shield looks at the
surrounding text (the contextConfidence helper) before deciding a
finding's confidence — you can see that reasoning in the finding list.
Why checksums beat bigger models
A checksum digit costs one line of code, runs in microseconds, and has a
measurable false-positive rate you can unit-test. A model cannot make that
promise: it generalises, which is exactly what you do not want when deciding
whether S1234567D is someone's identity. The right division of
labour is rules for everything structured, and the model only for what has no
structure at all — names in free text. That division also keeps the offline
path fast: masking with rules alone needs no download at all.
The formats shipped
The detector set covers: Singapore NRIC/FIN (checksum letter), SSN (shape + area/group validation), Aadhaar (Verhoeff), PAN (prefix alphabet + check digit), UK NINO (prefix alphabet), UK NHS number (mod-11), Netherlands BSN (mod-11 proef), Denmark CPR (date + mod-11), Brazil CPF (two mod-11 digits), Australia TFN (weighted sum), Canada SIN (Luhn), Ireland PPS (shape), plus company registries such as Singapore UEN. Phone shapes cover SG, US, UK, IN, AU, DE and the generic international form as fallback — a number from an unlisted country is still masked, with lower confidence.
One more thing about masking
Two occurrences of the same NRIC should become the same token. If row 42 and
row 1,183 both mask to <ID_1>, the reader cannot tell one
person from another by accident — and neither can a machine mining the freed
text for structure.
Everything on this page runs in your browser — open PII Shield and paste the document you are about to send.