Norske fødselsnummer i C# / Norwegian national ID numbers in C#

Available as NuGet package:

Code to verify Norwegian national id number (fødselsnummer / personnummer) written in C#.

Obeys 2013 standards as described in this Wikipedia article. Please let me know how if you find bugs / improvements. 🙂

(PS: This code is easy to test in LINQPad. Select C# Program, paste it in and hit run.)

4 thoughts on “Norske fødselsnummer i C# / Norwegian national ID numbers in C#”

  1. Hi Tedd,

    I am trying to apply similar logic to a Teradata SQL query. What I am trying to find out is how the 2nd checksum is calculated if the 1st produces an “X” i.e. the first checksum was 10 which is replaced with an “X” (according to several sources in Wiki, Google etc).


    181251490 becomes 122 when multiplying each digit by the weight and adding the result.

    122/11 = 11 remainder 1

    11-1 = 10

    Check digit is therefore X

    181251490 becomes 181251490X

    So I need to understand how to use mod11 on 181251490X

    (one source: <a href="" rel="nofollow ugc"></a>)


    • Hi

      For Norwegian birth numbers there is no X, only digits. If the mod11 result is 11 its changed to 0, if result is 10 then number is invalid. Second control digit follows the same rule with multipliers vs indexes changed.


  2. Thank you, I was looking for test data, and oddly enough could not find it anywhere else.
    Long shot: Do you know where to find company numbers?



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.