Check Digit Calculator of Domestic Account Number

Estonian domestic account number with check digit consists of at least 4 and a maximum of 14 numeric digits. All characters in the account number structure are numeric. The first two digits are the code of the bank holding the account. The first digit of the bank code cannot be 0. The check digit is incorporated in the account number. It is always the last digit of the string.

Domestic account number without check digit:
Check digit:
Complete domestic account number with check digit:


Algorithm in PHP

function arvutaViitenumber($nr){
     $nr = (string)$nr;
     $kaal = array(7,3,1);
     $sl = $st = strlen($nr);
     $total = 0;
     while($sl > 0 and substr($nr, --$sl, 1) >='0'){
         $total += substr($nr, ($st-1)-$sl, 1)*$kaal[($sl%3)];
     $kontrollnr = ((ceil(($total/10))*10)-$total);
     return $nr.$kontrollnr;