NPI Check Digit Routines for SQL Server

Click here For a submission by Ron Wielage of Indiana University Medical Group.
Click here For a submission by Jason Ellingson - OUR Lab, inc.

Explanation of 80840 Prefix

Peter T. Barry, 7 May 2004 (Updated 5 Jan 2005)
Peter Barry has created an essay that provides background information about the 80840 implicit prefix used in calculation of the NPI check digit. Click here to view the PDF memorandum.

NPI Transition Plan

Kepa Zubeldia, 5 April 2004
An essay on how to ease the transition to the National Provider Identifier while maintaining the healthcare provider identity. Click here to view the PDF memorandum.

CMS' NPI Final Rule Presentation

Pat Peyton of CMS gave an outstanding presentation on the NPI Final Rule at the February 2004 X12 meeting. Click here to view the PowerPoint file used for this presentation.

NPI Validator Software Routines

According to the NPI Final Rule published in the Federal Register on January 23, 2004, each NPI will contain a check digit that is calculated using the ISO Standard 7812-1 Luhn check digit algorithm. The NPI is a 10-digit number, with the check digit in the 10th position. Calculating the check digit must take into account that the NPI may be preceded by the ISO prefix of 80840, and the check digit must be the same with or without the 80840 prefix. Therefore the check digit calculation of the 10 digit NPI must introduce a constant factor to compensate for the absence of the 80840 prefix.

Ingenix has written a software routine, in the C programming language and based on the reference implementation of the standard, that can help you verify the validity of the check digit of the NPI within your system. This validation routine uses the Luhn algorithm and takes into account the presence or absence of the 80840 prefix. Another software routine allows you to re-calculate the NPI check digit, in case you find it necessary.

This source code is presented to the public domain as a contribution from Ingenix to facilitate the implementation of HIPAA. Feel free to use it and modify it to suit your needs. The code is free and is available without the need for a license. There is no warranty of any kind.

Click here to download the source code in C.
Click here to download the source code in C#, provided by Christopher Sawyer.
Click here to download the source code in VB / VBA, provided by Martin Morrison.
Click here to download a VBScript implementation, provided by Martin Morrison.
Click here to download a Java Script implementation, provided by Jerry Reed -
Click here to download a python implementation, provided by Ned A. Mossman.

The Luhn Algorithm

Luhn formula for computing modulus 10 "double-add-double" check digit as it originally appeared in the Annex B to ISO Standard 7812-1. This reference implementation does not take into account the 80840 prefix.

The Luhn Mod-10 Method implemented with lookup tables, but without accounting for the 80840 prefix.

"Secrets of the LUHN-10 Algorithm - An Error Detection Method" is an interesting page about the use of the algorithm for credit cards.

Here is a cool interactive calculator for the NPI with a step-by-step explanation of the process, courtesy of Barry DeBruin.


National Provider ID Final Rule Published

On January 23, 2004, HHS published the Final Rule that adopts the National Provider Identifier (the NPI) as the standard unique health identifier for health care providers. This rule becomes effective 16 months after its publication date (May 23, 2005). Providers need not take any action to apply for NPIs until that date.

This rule is available from the Federal Register as a PDF Document. The CMS website at also provides a link to this Final Rule.

NPI original NPRM

The original proposed rule (NPRM) can be found on the Federal Register site as a PDF Document. Sometimes the Federal Register site is difficult to access. You may find it easier to access the NPRM at the HHS site.


    2001-2015 Ingenix. All rights reserved.  |  Privacy Policy  |  Certification  |  ICD-10 Acceptance

  wjcp3clcweb06 -- 04 October 2015 -- 06:47:46 AM MDT