Validate Swedish Personal Identity Numbers

A Swedish personal identity number can be written in a lot of different ways. It normally takes one of the standard forms (YYMMDD-BBBC, YYMMDD+BBBC or YYYYMMDDBBBC) but can also include variations with whitespaces etc. Use the form below to parse a value and find out data that be extracted form the number such as date of birth and gender.

170621-2394

10 Digit String 170621-2394 This is the most common format, often refered to as YYMMDD-XXXX. The year is represented as 2 digits and the delimiter provides the info required to get the full year.
12 Digit String 201706212394 The format that is the receomended one to use when persisting it as it contains the full year as digits and no delmiter that changes over time..
Year 2017 The year the person was born.
Month 06 The month the person was born.
Day 21 The day the person was born.
Note: Because of a limited amount of birth numbers per day (1000) a person might not receive the exact day as the day part. It can be a few days later or earlier, but always within the same month.
Delimiter - By default a hyphen (-) but turns into a plus (+) the year the person turns 100.
Birth Number 239 A number to uniqely identity a person born on the day. 1000 in total, 500 female (even numbers) and 500 male (odd numbers).
Checksum 4 Calculated using the Luhn algorithm on the 10 digit string (without delimiter).
Gender Male Extracted from Birth Number.
Date of Birth 2017-06-21 Extracted from Year, Month and Day. See potential limitation on Day.
Age 7 Extracted from Date of Birth. See potential limitation on Day.