Skip to content

isbn

Validates an ISBN (International Standard Book Number) — ISBN-10 or ISBN-13.

Options

OptionTypeDefaultDescription
messagestringlocale defaultCustom error message

Playground

Valid values

ValueNotes
"978-0-306-40615-2"Valid ISBN-13 with hyphens
"0-306-40615-2"Valid ISBN-10 with hyphens
"9780306406157"Valid ISBN-13 without hyphens

Invalid values

ValueReason
"978-0-306-40615-3"Wrong check digit
"12345"Too short

Notes

  • Empty string ("") always returns valid: true. Combine with notEmpty to require a value.
  • Accepts both ISBN-10 (10 digits) and ISBN-13 (978- or 979- prefix, 13 digits).
  • Hyphens are optional and ignored during validation.

Released under the MIT License.