Personal identity number (Sweden)
The personal identity number (Swedish: personnummer) is the Swedish national identification number. When it was introduced in 1947 it was probably the first of its kind covering the total resident population of a country (The Social Security number in the United States is older, but it did not cover the whole population). Numbers are issued by the Swedish Tax Agency (Swedish: Skatteverket) as part of the population register (Swedish: Folkbokföring).
The number is used by authorities, by health care, schools and universities (both public-run and private). Also used by banks (needing it by law for tax purposes and mandatory customer identification) and insurance companies (needing it for car liability insurance and for medical travel insurance coordination). Other companies often ask for it in return for a post-paid service, like a telephone subscription, to be able to check e.g. the person's credit record or address or if needed to perform debt collection.
The link between a person and the identity number is established through the civil registry and through identity documents and secondarily through the widespread use of the number in various contacts with authorities, businesses etc. They are necessary for personal service at banks, authorities, health care and other services which use the personal identity number. Most people are familiar with their full number and those of their children without hesitation. Personal identity numbers of individuals are openly available from the Swedish tax authorities to anyone who asks (over phone, letter, over the desk, but not over the internet), according to the Swedish principle of freedom of information. Redistribution of these numbers using computers are however governed by the law of personal details, an implementation of the Data Protection Directive.
The personal identity number consists of 10 digits and a hyphen. The first six correspond to the person's birthday, in YYMMDD form. They are followed by a hyphen. People over the age of 100 replace the hyphen with a plus sign. The seventh through ninth are a serial number. An odd ninth number is assigned to males and an even ninth number is assigned to females. Some county authorities, such as Stockholm, and some banks, have started using 12 digit numbers to allow YYYYMMDD. This format is also used on some Swedish ID-cards[clarification needed] and on the Swedish European Health Insurance Cards but not on state-issued identity documents.
Up to 1990, the seventh and eighth digits were correlated with the county where the bearer of the number was born or (if born before 1947) where he/she had been living, according to tax records, on January 1, 1947, with a special code (usually 9 as 7th digit) for immigrants.
The tenth digit is a checksum which was introduced in 1967 when the system was computerized. Originally, when the personal identity number was introduced, it had nine digits and the seventh and eighth denoted the county (Swedish: län) in which the subject was born or had been living in 1947 - see above. The seventh digit was 9 for foreign born. This system was replaced with the current system in 1990. Everyone however keeps their number and it is not hard to find out someone's number if you know the birth date, the birth county and the checksum algorithm. Even easier is to call the tax authority and ask, since the personal identity number is public information.
With citizens and other persons born in Sweden, the identity number is issued soon after the birth of a child has been reported by (normally) the parents and medical professionals. In exceptional cases, the number may be changed later in life, typically because the date of birth or the registration of gender of the child were in error. If a person undergoes full gender reassignment surgery later in life, the serial number is changed to make the 'gender digit' (no. 9) conform with their new physical sex. Changes in the records of who were someone's biological parents do not affect the number, which has nothing to do with family circumstances.
A review on the Swedish Personal Identity Number was published in 2009 by medical researchers and representatives of the Tax authority, Statistics Sweden and the National Board of Health and Welfare.
Similar identity numbers 
People who have no Swedish personal identity number can receive a co-ordination number (Swedish: samordningsnummer) instead. It is issued by the Tax Agency at the request of a public agency. It is used for contact between a person and an agency which would otherwise require the use of a personal identity number, for example for people staying less than a year in the country or for Swedish citizens who have never been residents of Sweden. It is structured along the same lines, but with the day in the date of birth advanced by 60 (giving a number between 61 and 91).
People who have no known Swedish personal identity number or co-ordination number but need health care, e.g. foreign tourists, unconscious people, newborn children needing special care (healthy newborn children are registered in its mother's medical record) and some more (e.g. for special privacy protection like HIV tests), will get a reserve number (Swedish: reservnummer) which is temporary and used only for the health care. They have the birth date (if known) and four more digits that can't be a real identity number.
Also, all organisations and companies have organisation numbers (Swedish: organisationsnummer). They look like personal identity numbers but have a "month" number of 20 or higher. They are used for tax purposes etc. and have to be printed on receipts.
To calculate the checksum, multiply the individual digits in the identity number and 212121-212. The resulting products (a two digit product, such as 16, would be converted to 1 + 6) are added together. The checksum is the last digit of 10 minus the last digit in this sum (note that if the last digit of the sum is zero, the checksum is 0).
The sum has the last digit of . That is then subtracted from ten to give the value: ; the checksum is the last digit (in this example, the only digit) of this:
If the sum had been , then subtraction of the last digit from would give the value . The last digit of this is which would be the resulting checksum.
See also 
- Population Registration in Sweden 3rd ed. (SKV 717B), December 2004, Skatteverket
- Ruby generator for Swedish Person identity numbers