What is ISBN-13?
The ISBN-13 (International Standard Book Number, 13 digits) is the global book identification system in effect since 2007. It replaced ISBN-10 and is compatible with the EAN-13 (European Article Number) standard used in product barcodes.
All book ISBN-13s start with prefix 978 (Bookland) or 979. The structure is:
- 978/979: GS1 prefix (identifies it's a book)
- Language group: Country or language (e.g., 0/1 English, 84 Spain, 987 Argentina)
- Publisher: Publisher identifier
- Title: Specific book identifier
- Check digit: Checksum calculated with modulo 10
This validator verifies the checksum but does not confirm if the book exists in commercial catalogs.
How the validation algorithm works
The check digit calculation uses modulo 10 with alternating weights:
- 1. Take the first 12 digits.
- 2. Multiply alternately by 1 and 3: first digit ×1, second ×3, third ×1, etc.
- 3. Sum all results.
- 4. Calculate
(10 - (sum % 10)) % 10. - 5. The result must match the last digit of the ISBN-13.
Example with 978-3-16-148410-0:
- Digits:
9 7 8 3 1 6 1 4 8 4 1 0 - Multiply:
9×1 + 7×3 + 8×1 + 3×3 + 1×1 + 6×3 + 1×1 + 4×3 + 8×1 + 4×3 + 1×1 + 0×3 - Sum:
9+21+8+9+1+18+1+12+8+12+1+0 = 100 - Check:
(10 - (100 % 10)) % 10 = (10 - 0) % 10 = 0✓
Another example with 978-0-306-40615-7:
- Sum: 100, expected check 7 (after full calculation) ✓
When and why to validate ISBN-13
ISBN-13 validation is essential in:
- Bookstores and e-commerce: Verify codes before searching inventory or distributor APIs.
- Point of sale (POS) systems: When scanning book barcodes (EAN-13 = ISBN-13).
- Self-publishing platforms: Amazon KDP, Lulu, etc., require valid ISBN-13s to sell internationally.
- Libraries and catalogs: Migrating ISBN-10 to ISBN-13 in legacy databases.
- Book search APIs: Google Books, Open Library, Goodreads, etc., accept ISBN-13 as unique identifier.
Validating before calling external APIs reduces costs (some services charge per request) and improves UX by providing immediate feedback in search or inventory forms.
Barcode scanners return the full ISBN-13. Validating it before processing prevents errors from dirty or partial scans.
Limitations and common mistakes
This validator does not verify:
- If the book exists in WorldCat, Google Books, or Amazon.
- If it's available, out of stock, or out of print.
- If metadata (title, author, publisher, price) are correct.
- If the ISBN was officially assigned by an ISBN agency.
Common implementation mistakes:
- Rejecting hyphens or spaces: Users type
978-3-16-148410-0,978 3 16 148410 0, or9783161484100. You should sanitize input. - Confusing with EAN codes of other products: Not all EAN-13s are ISBNs. Only those starting with 978 or 979 are books.
- Not validating exact length: Must be exactly 13 digits (excluding hyphens).
- Assuming all ISBN-13s start with 978: Since 2007, prefixes 979 are also used (initially 979-10 for France, now more countries).
To search book data:
- Google Books API:
https://www.googleapis.com/books/v1/volumes?q=isbn:9783161484100 - Open Library:
https://openlibrary.org/api/books?bibkeys=ISBN:9783161484100 - ISBNdb (requires API key):
https://api2.isbndb.com/book/9783161484100