Method Deck / other

ISBN-10 / ISBN-13 check digit

Validates an ISBN-10 or ISBN-13, or computes its check digit, per the ISBN standard.

Published for review. The Founder is checking every card himself; anything he strikes comes down the same hour.

Try it

Inputs

Outputs

Steps

  1. ISBN-10: weight the 10 digits 10,9,8,...,1 (left to right); the sum of digit*weight must be a multiple of 11 for a valid ISBN. The check digit (10th digit) can be 'X', representing 10.
  2. To compute an ISBN-10 check digit from the first 9 digits: sum digit_i*(10-i) for i=0..8, then check = (11 - (sum mod 11)) mod 11; if check is 10, use 'X'.
  3. ISBN-13: weight the 13 digits alternately 1,3,1,3,...,1 (left to right); the sum of digit*weight must be a multiple of 10 for a valid ISBN.
  4. To compute an ISBN-13 check digit from the first 12 digits: sum digit_i*(1 if i even else 3) for i=0..11, then check = (10 - (sum mod 10)) mod 10.

Constants

None.

Sources

Worked example and test vectors

NameInputsAnswer
worked example{"isbn_type":"isbn10","operation":"compute","digits":"020161622"}X
test vector: ISBN-13 validate{"isbn_type":"isbn13","operation":"validate","digits":"9780306406157"}true

Published card