/svensk-personnummer

Swedish Personnummer Generator & Validator

Generate and validate valid Swedish personal numbers (personnummer) and coordination numbers (Luhn) locally for testing.

How it works

A Swedish personal number (personnummer) is 10 digits: six for the birth date (YYMMDD), three serial digits and one check digit computed with the Luhn algorithm (MOD10). The third-to-last digit encodes gender: odd for men, even for women.

A coordination number (samordningsnummer) is the same, but the day has 60 added (day 61-91). It is issued to people without registered residence in Sweden.

Test data only. The numbers are randomly generated and mathematically valid, but belong to no real person. Use them for testing and development, never to impersonate anyone.

About this tool

A Swedish personal identity number (personnummer) has 10 or 12 digits in the format `YYMMDD-XXXX` (short) or `YYYYMMDD-XXXX` (long), where the first six/eight digits are the birth date. After the hyphen comes a three-digit serial number and finally a check digit computed with the Luhn algorithm. Numbers are issued by Skatteverket to everyone registered in Sweden. From age 100 the hyphen is replaced by a plus sign (`+`). The tool validates syntax, checks the birth date, verifies the Luhn check digit and extracts sex (even = woman, odd = man in the second-to-last digit) and birth date. Everything runs locally.

How to use it

  1. Paste or type the personnummer into the input field.
  2. Both short format (`800101-1234`) and long format (`19800101-1234`) are accepted.
  3. The tool checks that the birth date is valid and the Luhn check digit matches.
  4. For a valid number, birth date, age and sex are shown.
  5. Everything happens locally, personal numbers never leave your browser.

Examples

Valid short format
Input811228-9876
Output✓ Valid · b. 28.12.1981 · Male · age 42
The 9 in the third-to-last position is odd = male. Luhn sum ends in 0 (mod 10).
Long format
Input19811228-9876
Output✓ Valid · b. 28.12.1981
Long format avoids ambiguity between 1900s and 2000s, recommended in databases and APIs.
Coordination number
Input800161-1234
Output✓ Valid coordination number (day > 60)
People without Swedish registration get a coordination number. The day has +60 added (1st → 61, 2nd → 62 etc.).

Common use cases

  • Customer databases in Swedish SaaS and e-commerce.
  • HR systems and payroll for Swedish employees.
  • Banking and BankID login where personnummer must be verified.
  • Healthcare and medical record systems (region assignment in Sweden).
  • Housing registration, social insurance and other government services.
  • Automatic age validation (18-year limit for alcohol, gambling, etc.).

Frequently asked questions

What does the third-to-last digit mean?
It’s the sex indicator: even = female, odd = male. It’s the third-to-last digit (position 9 of 10). Until 1990, the three middle digits also encoded the birth county, but this information was abolished.
Is personnummer sensitive under GDPR?
Yes. Personnummer is directly identifying personal data under GDPR and shouldn’t be shared unnecessarily. Sweden has specific rules in Dataskyddsförordningen with stricter requirements for processing. Only use personnummer where legally required or strictly necessary; consider alternatives like email or customer ID.
What’s the difference between personnummer and samordningsnummer?
A coordination number is assigned to people not registered in Sweden but needing identification (short-term visitors, guest researchers, EU workers). The format is identical to personnummer but the day has +60 added (i.e. day 61–91 instead of 01–31). People who later become registered receive a permanent personnummer.
Can I legally look up someone’s personnummer?
Personnummer is public information in Sweden (unlike Norway), but processing is strictly regulated. Skatteverket has services for authorised uses. Unauthorised collection of many personnummer for marketing or resale can breach both GDPR and Swedish data protection law.

Technical background

The Luhn algorithm: multiply each digit (from the left) alternating by 2 and 1. If the product is two digits, sum them (12 → 1+2 = 3). Sum all the results. The personnummer is valid if the sum is divisible by 10. For Swedish personnummer, Luhn is computed on the 10 digits including the check digit. Birth date: first two digits = year (without century; use +/- for context), next two = month (01–12), next two = day (01–31, or 61–91 for samordningsnummer). The serial (positions 7–9) is assigned randomly by Skatteverket. Although the third-to-last digit determines sex (even = female, odd = male), there’s no structural extra meaning. API access: government’s SPAR (Statens personadressregister) via authorised agreement.