# Isbn validate

`isbn-validate` · version 1.0.0 · Identifiers & check digits · free, no key needed

Validate an ISBN-10 (mod 11, X allowed) or ISBN-13 (EAN mod 10) check digit and return the other form when it exists.

**Use when you need to: validate an isbn · check isbn check digit · convert isbn 10 to isbn 13.**

## Decide before calling

Read the [versioned contract](/v1/tools/isbn-validate/versions/1.0.0) and the supported scope below. Reuse `isbn-validate@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `isbn-validate@1.0.0` for validate an isbn. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- validate an isbn
- check isbn check digit
- convert isbn 10 to isbn 13
- convert isbn 13 to isbn 10
- is this isbn valid
- isbn checksum validator
- does this book barcode pass its check digit

## Not supported

- hyphenating an ISBN into its registration group / registrant / publication segments (needs range data)
- looking up which book an ISBN actually identifies
- validating an ISSN or ISMN (see issn-validate / ismn-validate)

## Behavior

- Normalization: remove every '-' and ' ' from isbn first; the 17-byte limit and 1-byte minimum apply to the original, unstripped isbn.
- Character counting: every length, position and 'character' counts Unicode code points, not UTF-16 code units, so the echoed isbn10, isbn13 and prefix_ean never split a surrogate pair.
- format is isbn10 when the stripped value is exactly 10 characters, isbn13 when exactly 13, and null (reason wrong_length) otherwise.
- isbn10 charset: characters 1-9 digits, character 10 digit or uppercase X (no case folding). isbn13 charset: all 13 characters digits. A violation is reason invalid_character, checked once format is set.
- isbn13-only: once the charset passes, characters 1-3 must be '978' or '979', and characters 1-4 must not be '9790' (979-0 is allocated to the ISMN under ISO 10957 and is never an ISBN), else reason unknown_prefix.
- isbn10 check: sum of d_i*(11-i) for i=1..9 must be 0 mod 11 once the check character is included; a mismatch is reason check_digit_mismatch. isbn13 check (only reached when the prefix is recognized): the EAN weight-1,3 sum over all 13 digits must be a multiple of 10.
- prefix_ean is 978 (constant) when format is isbn10, or the raw 3-character prefix when format is isbn13; both populated whenever format is non-null.
- isbn13 is populated whenever format is isbn10 and characters 1-9 are all digits (regardless of character 10), or whenever format is isbn13 and the charset passes (regardless of prefix or its own check digit); isbn10 is the unconditional raw echo of the stripped input when format is isbn10, or, when format is isbn13 with charset passing and prefix_ean 978, characters 4-12 plus a freshly computed mod-11 check character (null for prefix 979).
- valid is true only when format is set, the charset passes, (for isbn13) the prefix is recognized, and the check digit passes, in that order; only one reason is ever returned.

## Input

- `isbn` (string, required): min length 1; max length 17

## Output

- `valid` (boolean, required)
- `reason` (one of null, "wrong_length", "invalid_character", "unknown_prefix", "check_digit_mismatch", required)
- `format` (one of null, "isbn10", "isbn13", required)
- `isbn10` (string or null, required): min length 10; max length 10
- `isbn13` (string or null, required): min length 13; max length 13
- `prefix_ean` (string or null, required): min length 3; max length 3

## Limits

- max isbn bytes: 17

## Example

Request input:

```json
{
  "isbn": "0-7475-3269-9"
}
```

Response:

```json
{
  "result": {
    "valid": true,
    "reason": null,
    "format": "isbn10",
    "isbn10": "0747532699",
    "isbn13": "9780747532699",
    "prefix_ean": "978"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "isbn-validate",
  "version": "1.0.0",
  "input": {
    "isbn": "0-7475-3269-9"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/isbn-validate/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"isbn":"0-7475-3269-9"}'
```

The machine-readable contract is at [/v1/tools/isbn-validate/versions/1.0.0](/v1/tools/isbn-validate/versions/1.0.0).

### CLI

```sh
node cli.mjs run isbn-validate 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Checkdigit validate](/tools/checkdigit-validate): Validate a full value's trailing check digit(s) against a named algorithm (Luhn, Verhoeff, Damm, ISO 7064, GS1, mod 10).
- [Issn validate](/tools/issn-validate): Validate an 8-digit ISSN's mod 11 check digit (X allowed) and compute its 977-prefixed EAN-13 barcode form.
- [Ismn validate](/tools/ismn-validate): Validate an ISMN's EAN mod 10 check digit in M-form or 979-0 form and return the canonical 13-digit form.
- [Cas number validate](/tools/cas-number-validate): Validate a CAS Registry Number's position-weighted mod 10 check digit over its variable-length first segment.
- [Gs1 key validate](/tools/gs1-key-validate): Validate a GTIN-8/12/13/14, GLN, SSCC or GSIN's GS1 mod-10 check digit and look up its 3-digit GS1 prefix meaning.
- [Isin validate](/tools/isin-validate): Validate a 12-character ISIN's ISO 6166 Luhn check digit and parse its country prefix, NSIN and NSIN scheme.
