DevTools Logo

Sweden Personnummer Generator

Sweden Personnummer Generator

Generate Swedish personal identity numbers (YYMMDD-NNNC) with a valid birth date and Luhn check — synthetic test data only

Runs in your browser

For Development & Testing Purposes Only - Synthetic Mock Data

Settings

1 value

Generates one value with a valid checksum. Press ⌘/Ctrl+Enter for a fresh one.

Generated value

No value yet

Set options, then press Generate.

Generated values are valid in shape but randomized (Test Data).

Legal Disclaimer: Generated data is for software testing and validation purposes only (e.g. verifying input masks, form validation, or database seeding). It is randomly generated and not taken from any real record, but a random value can coincidentally match a real, issued number, so never use it in real applications, payments, KYC or official forms. Using it to impersonate real people or for any fraudulent activity is illegal. DevTools accepts no liability for how generated data is used.

    Examples

    Generate a personnummer

    Input
    Personnummer · Generate
    Output
    811218-9876

    Birth date 18 December 1981 and serial 987; the final 6 is the Luhn check digit.

    Validate a pasted value

    Input
    811218-9876
    Output
    Valid — Luhn check digit 6

    The validator recomputes Luhn over the ten digits after removing the hyphen.

    Reject a wrong check digit

    Input
    811218-9877
    Output
    Invalid — bad check digit: expected 6, found 7

    The failure names the expected digit instead of rejecting the format.

    About this tool

    The Sweden Personnummer Generator produces one personal identity number in the YYMMDD-NNNC layout: a birth date, a three-digit serial and a Luhn check digit. The third serial digit is odd for men and even for women, so the generated value carries a consistent gender marker.

    A plus sign instead of a hyphen marks people aged 100 or over. Generation picks a real birth date and derives the Luhn digit over the ten digits, and validation reports an impossible date before it checks that digit.

    These are synthetic values for QA and development, never for real applications, KYC checks, tax filings, identity documents or impersonation. A random value can coincide with a real, issued number, and DevTools accepts no liability for how generated data is used. Everything runs locally in your browser.

    What this tool does not do

    • Generates personnummer only; organisation numbers live in a separate tool.
    • The tool does not assign a specific birth date or gender on request.
    • Validation checks structure and Luhn, not whether the number is in use.
    • A random value can coincide with a real person's number.

    How to use this tool

    1. Choose the personnummer option

      The tool is pinned to the Swedish personnummer, which uses YYMMDD-NNNC with a Luhn check digit.

    2. Generate a value

      Click Generate to create one number with a real birth date, a three-digit serial and a valid check digit.

    3. Validate or copy

      Switch to Validate to check a pasted personnummer, or copy the result and download it as a .txt file.

    Use cases

    Onboarding identity fields

    Fill Swedish identity fields with a personnummer that has a real birth date and a valid Luhn digit.

    Payroll fixtures

    Seed payroll and benefits screens that require a personal identity number for test employees.

    Date validation tests

    Pair a valid value with an edited month or day to cover the birth-date rejection path.

    Personnummer structure

    PartRule
    LayoutYYMMDD-NNNC
    Birth dateA real calendar date
    Serial3 digits; third digit odd for men, even for women
    Check digitLuhn over the ten digits
    SeparatorHyphen normally; plus sign for people aged 100 or over

    811218-9876 is the layout example used by the tool and its tests.

    Common mistakes

    Mistake:Reading the serial as random

    Fix:The third serial digit encodes gender, so odd and even serials behave differently.

    Mistake:Skipping the birth date check

    Fix:The validator rejects impossible dates such as month 13 before the Luhn step.

    Mistake:Using the plus sign for anyone

    Fix:A plus sign marks people aged 100 or over, not a formatting preference.

    Frequently asked questions

    Are these real Swedish personnummer?

    No. Every value is synthetic test data for QA and development and must not be used for real applications, KYC checks, tax filings, healthcare, or identity documents; DevTools accepts no liability for their use.

    Does the serial number encode gender?

    Yes. The third digit of the three-digit serial is odd for men and even for women, so a generated value always carries a consistent gender marker.

    What does a plus sign instead of a hyphen mean?

    A plus sign marks a person aged 100 or over. The validator accepts both separators and resolves the century from the sign when the year is given as two digits.

    Can a generated personnummer match a real person?

    It can. The Luhn check only confirms the number is well formed, so a random value may coincide with a real person's number. Keep generated values in test environments only.

    What happens if the birth date is impossible?

    The validator reports the bad month or day before it evaluates the Luhn digit, so an edited date such as month 13 fails with a date error rather than a checksum error.

    References & standards