David's Homepage: ISIN check digit algorithm

# ISIN check digit algorithm

The last digit of an ISIN is a check digit, calculated from the other 9 digits which of the numerical portion of the ISIN, using the so-called "double-add-double" algorithm. This document will describe the algorithm, then apply it to an example ISIN, then give an example function that will calculate the check digit.

## Description of algorithm

These are the steps of the calculation. Apply them to the first nine digits of the ISIN to obtain the tenth.

1. Starting with the right-most digit, replace each alternate digit with the sum of the digits of its double.
2. Take the sum of these digits. Take its last digit, d.
3. The check digit is 9-d.

## Example: `GB0004005475` (HSBC)

>             Original number:  0  0  0  4  0  0  5  4  7  [5]
>         x2 alternate digits:  0     0     0    10    14
>                  add digits:  0     0     0     1     5
>     All digits after step 1:  0  0  0  4  0  0  1  4  5  [5]

>              sum of digits: 4 + 1 + 4 + 5  = 14
>          last digit of sum:                   4

>                check digit:         9 - 4  =  5  --  correct answer!

David Chan Tue Feb 27 16:16:48 2001