personnummer
Validate swedish personal identity numbers
Personnummer is a small open-source project created to validate, format and determine sex and age from swedish personal identity numbers. Support the project by becoming a backer or sponsor at OpenCollective.
available in:Bash,C/C++,C#,Clojure,D,Dart,Elixir,Gleam,Go,Haskell,Java,,Kotlin,Lua,Perl,PHP,Python,Ruby,Rust,Scala,Swiftand forV.
Features
- validation
- formatting
- determine age
- determine sex
- determine if coordination number
- determine if interim number
All features might not be implemented in all languages. Full specification can be found here.
Try
input
result
valid | no |
short format | n/a |
long format | n/a |
age | 0 |
sex | n/a |
coordination number | no |
interim number | no |
Some implementations may be a work in progress if you find a bug, please open an issue in the specific implementation repository.
If an implementation for your favorite language is missing, feel free to port it over from one of the existing versions. There are still plenty of languages to contribute to: R, Nu, Groovy, Julia, Racket, F#, Clojure, Erlang.
Who is using Personnummer
Add your logo here.
Swedish personal number generator
Use of Personnummer (Personal Identification Number)
Swedish personal identification numbers are widely used throughout the society to identify people. It works much like the social security number in the USA. The Swedish personal identification number consist of the date you are born, followed by three identification digits (the third identification number is odd for people identified as male at birth, and even for women) and a trailing checksum from the Luhn algorithm (based on six number date format and the three identification numbers).
Centenarians
Most of the time the personal identification numbers are used with 10 digits; six for birth date and the four last digits for identification and checksum. Since a two-number birth year representation would make it possible to confuse people older than years with young people with the same two-number birth year representation some means of distinction between these are sometimes required. The official way of doing this is by substituting the regular dash between the birth date and the four trailing digits with a plus sign instead.
Samordningsnummer
People that are not residents of Swede
API – adressuppgifter
Med vårt JSON-API integrerar du mycket enkelt en möjlighet att verifiera kunder i onboarding-processen, komplettera adressuppgifter med exempelvis telefonnummer, samt skapa en pålitlig sökfunktion med skräddarsytt innehåll. Marknadsinformation i Sverige AB är specialister på målgruppsurval, analys, registervård och API-lösningar utifrån företagsinformation, och har en marknadsledande databas vad gäller täckning av namn på beslutsfattare och personliga epostadresser bland svenska företag.
API – adressuppgifter till privatpersoner
Vi har information om samtliga personer över 18 år. Fyll bara i personnummer eller telefonnummer för att hämta dagsaktuella och uppdaterade adressuppgifter till privatpersoner. Genom säkra förbindelser levereras informationen på några få sekunder. Personuppgifterna uppdateras regelbundet mot SPAR.
Adressuppgifterna kan också kompletteras med fastighetsinformation och fordonsinformation. Marknadsinformation i Sverige AB har många års erfarenhet och gedigen kunskap gällande målgruppsurval, analys, registervård och API-lösningar utifrån personuppgifter.
Teknisk specifikation och test
Läs den tekniska specifi
Biblioteket SamLogic Number Library, som ingår i Swedish .NET Classes, innehåller klasser (API) för hantering av svenska personnummer, organisationsnummer, bankgironummer, plusgironummer mm. Klassen som hanterar personnummer hanterar även samordningsnummer, som brukar användas för att identifiera personer som inte är folkbokförda i Sverige. Både 10 och siffriga personnummer stöds. Vid siffriga personnummer anges årtalet med 4 siffror, vilket blivit vanligare på senare tid. Metoder för att erhålla kön, ålder och födelsedatum från ett personnummer eller samordningsnummer ingår också. Validering av personnummer, organisationsnummer, bankgironummer, plusgironummer mm Alla personnummer, organisationsnummer, bankgironummer, plusgironummer mm har en kontrollsiffra sist. Med klasserna i SamLogic Number Library kan du kontrollera att denna kontrollsiffra är korrekt. Klasserna kan även hitta andra fel i ett nummer, exempelvis felaktiga datum i ett personnummer. En generell metod för att kontrollera att kontrolls . |