idnumbers
    Preparing search index...

    The Personal Identity Number of Sweden. This page is generated from the registry metadata of the library.

    Property Value
    Country code SWE, SE
    ID type Personal Identity Number
    Official name Personnummer
    Also known as Personal Identity Number; personnummer
    Display format YYMMDD[+-]XXXC
    Input masks ######-####
    Length 10 to 13
    Example 811218-9876
    Checksum yes
    Checksum algorithm Luhn (mod 10)
    Parsable yes

    The root entry registers every country:

    import { validateNationalId } from 'idnumbers';

    validateNationalId('SWE', '811218-9876').isValid; // true

    To bundle only this country, import its definition from idnumbers/countries/swe and pass it to register():

    import { register, validateNationalId } from 'idnumbers/core';
    import { country } from 'idnumbers/countries/swe';

    register(country);
    validateNationalId('SWE', '811218-9876').isValid; // true