Strip hyphens and spaces before validation—ISBNs are often formatted with separators for readability (978-0-306-40615-7). Normalize to digits only, keeping 'X' for ISBN-10 check digits. Always convert to uppercase when handling X.
Validate check digits correctly: ISBN-10 uses weighted sum (10×d1 + 9×d2... +1×d10) mod 11 = 0. ISBN-13 uses alternating weights (1,3,1,3...) with sum mod 10 = 0. Implement both algorithms to support legacy and modern ISBNs.
Provide helpful error messages: Instead of 'Invalid ISBN', specify 'Invalid ISBN-10 check digit' or 'ISBN-13 must start with 978 or 979'. This helps users understand whether they have typos or are using the wrong format.
Support conversion between formats: ISBN-10 can convert to ISBN-13 by prefixing 978 and recalculating the check digit. Offer this feature to help users update legacy databases to modern standards.