ISBN tools

Book Search   ISBN directory   ISBN.java   Gory Details

FAQ

What is an ISBN?

An ISBN is a 10-digit or 13-digit number that identifies a book for purposes of commerce and supply chains. The last digit of the ISBN is a check digit used to detect transcription errors. This last digit is sometimes an "x".

13 digit ISBNs began to appear on January 1 2005, and all ISBN systems are required to support 13 digits by January 1, 2007.

The first number or numbers of a 10 digit ISBN identifies the country that issued the publishers prefix; this number is followed by a dash and the publisher prefix. 13-digit ISBN's start with either 978 or 979, and the 9 digits that follow correspond to the first 9 digits of a 10-digit ISBN.

The dashes (or spaces) in the ISBN occur in different places depending on the number and are meaningful, but are so frequently omitted that you can't really use the dashes for much. If you're really interested, here are the Gory Details

What is an ISBN barcode?

There are two types of isbn barcodes, the 10-digit ISBN and the 13-digit UPC with prefix 978 or 979 (a new prefix is planned). To get the 10 digit isbn from the upc, remove the 978 and the last digit (a check digit) then recompute the isbn check digit using our java class. If the 13 digit isbn starts with 979, then there is no equivalent 10-digit ISBN. An explanation of the ISBN and UPC check digit algorithms is at Book Industry Study Group.

I want to sell my book on Amazon, how do I get an ISBN for it?

ISBN prefixes are issued to publishers by natioanl ISBN agencies. A list of the agencies is at www.isbn.org

I want to catalog my books using ISBN. How can I use ISBN to get title, author, etc?

If you're interested in cataloging a book collection check out Zarf's bookscanning project Any barcode scanner made for the PC can be used to scan these barcodes, including the infamous CueCat ®.

We've found a nice application that helps you use ISBN to get metadata into a personal database. It's called ReaderWare.

Readerware consists of 3 separate programs for cataloging books, CD's and videos. All feature Readerware auto-catalog, the easiest way to catalog your collection. Simply scan or enter the product barcode or ISBN, Readerware does the rest. It will search the internet and automatically catalog the item for you, complete with cover art. Can be used with virtually any barcode reader.

Other features include table, tree and fish eye views, easy to use wizards, integrated backup and restore, customizable reports, import/export, standalone or client/server mode, SQL database, Palm pilot support.

Get readerware here!

Where can I get an ISBN database?

If you need an ISBN database, you have the choice of buying one or collecting free data. Because most book data is available for free, there's not a big market for ISBN databases. Nonetheless you can subscribe to books-in-print data services from Library of Congress (recommended), Muse (recommended, but expensive), Baker&Taylor and Ingram. Most people asking this question are interested in free data, which unfortunately means they need to know about "MARC records" and "Z39.50". MARC records are how libraries add book data to their catalogs, and Z39.50 is a protocol (like http) used to request and deliver MARC records. Luckily, you don't need to know much more than that. Endnote, from ISIResearchSoft is software that can connect to libraries using Z39.50 to download book data. You can also use it with MSWord to automate the production of reference lists. You should be able to get all the ISBN data that you need with EndNote. (There's also a version for Mac)


Are there any tools for using ISBN in an XML schema?

Yes there are! xfront has a detailed schema for ISBN, as well as a pretty cool XSLT that validates the check digit. I

Fast Book Search


New search for: title   or author
'any word''any order'     'phrase'    'starting with'    'exact'  

ISBN Directory

Do you have an ISBN, and want to know what bookk it belongs to? here's a directory of ISSN's.

From 0000012742 to... 0028604164 to... 0062059017 to... 0075546701 to... 0130213268 to... 0140105425 to... 0141304286 to... 0195052668 to... 0198775024 to... 0226360830 to... 0253388465 to... 0295973668 to... 0309037263 to... 0312226039 to... 0319220303 to... 0340589353 to... 0373035810 to... 0380976048 to... 0394726499 to... 0415047013 to... 0435086081 to... 0449150380 to... 0471285935 to... 0486248984 to... 0517541459 to... 0521468752 to... 0531300382 to... 0553662287 to... 0582275652 to... 0606008780 to... 0613119592 to... 0671522817 to... 0674874463 to... 068483457X to... 0689816219 to... 0708312578 to... 0717624374 to... 0736802258 to... 0747251290 to... 0749519150 to... 0750922443 to... 0760300887 to... 0764170260 to... 0781432537 to... 0786200553 to... 0788816357 to... 0792273680 to... 0801863325 to... 0804231052 to... 0806633417 to... 0809225360 to... 0812047192 to... 0814326102 to... 0816719721 to... 0822315416 to... 082560009X to... 0834208962 to... 0843940425 to... 0850393469 to... 0861636147 to... 0867161043 to... 0873491491 to... 0876859449 to... 0880104538 to... 0884194442 to... 0891349529 to... 0896600505 to... 0907758509 to... 0924359021 to... 0937611565 to... 0946621799 to... 0964287404 to... 1550820982 to... 1557130647 to... 1559352000 to... 1561450405 to... 1563923513 to... 1566395658 to... 1568952767 to... 1572302097 to... 1575842998 to... 1581170920 to... 1841391131 to... 1853109789 to... 1856082490 to... 185868868X to... 1861262183 to... 1874707316 to... 1882513010 to... 1887921273 to... 1898617139 to... 2844280099 to... 6305089493 to... 9626340312

Book Search   ISBN directory   ISBN.java   Gory Details

ISBN Java Class

The com.openly.info.ISBN java class verifies Check digits for ISBN's and includes support for ISBN-13:
package com.openly.info;


/**
 * ISBN wraps a String interpreted as an ISBN. It checks the checksum, too. supports both 10 digit and 13 digit ISBN
 * @author Eric Hellman
 *
 *  Copyright 2000-2005  by Openly Informatics, Inc.
 *  http://www.openly.com/
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free
 *  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA 02111-1307, USA
 *@version 
 *
 *
 */
public class ISBN implements StandardID {
	private static final String NUMVALUES = "0123456789X";

	private String value;
	private String value13;
	
	/**
	* the constructor requires a valid isbn string; dashes and spaces are ignored.
	*/
	public ISBN(String isbn)
		throws InvalidStandardIDException{
		init (isbn,false);
	}
	/**
	* the constructor requires a valid isbn string; dashes and spaces are ignored.
	*@param fix if true, constructor will try to fix bad check digits, otherwise will throw exception for bad isbn
	*/
	public ISBN(String isbn, boolean fix)
		throws InvalidStandardIDException{
		init(isbn,fix);
	}
	
	private void init(String isbn, boolean fix)
		throws InvalidStandardIDException{	
		if (isbn.length()<10) throw new InvalidStandardIDException("ISBN length<10");
		isbn=isbn.toUpperCase().trim();
		
		//remove all but numbers, X
		char[] theChars =isbn.toCharArray();
		int i; 
		int val=0;
		StringBuffer sb= new StringBuffer();
		for ( i=0; i=0 ){
				//valid character
				sb.append(theChars[i]);
			} else {
				//invalid character
				if (!fix && theChars[i]!=' ' &&theChars[i]!='-') throw new InvalidStandardIDException("invalid char");
			}
		}
		isbn=sb.toString();

		theChars =isbn.toCharArray();
		if (theChars.length<9) throw new InvalidStandardIDException("ISBN length<9");
		if (theChars.length>13) throw new InvalidStandardIDException("ISBN length>13");
		if (theChars.length==11) throw new InvalidStandardIDException("ISBN length=11");
		if (theChars.length==10) {
			//10 digit isbn
			int checksum=0;
			int weight=10;
			//compute checksum
			val=0;
			for ( i=0; weight>0 ; i++){
				val=NUMVALUES.indexOf(theChars[i]);
				if (val >=0 ){
					//valid character
					if (val==10 && weight!=1) throw new InvalidStandardIDException("X in a bad place");

					checksum=checksum+weight*val;
					weight--;
				} else {
					//invalid char
					// should never happen
					throw new InvalidStandardIDException("invalid char");
				}
			}
			if ((checksum%11)!=0){
				//bad checksum
				if (fix){
					value =isbn.substring(0,9)+checkDigit(isbn.substring(0,9));
				} else 
					throw new InvalidStandardIDException("bad checksum-10");
			} else 
				value=isbn;
				
			//make 13 digit isbn
			value13="978"+value.substring(0,9)+checkDigit13("978"+value.substring(0,9));
			
			
		} else if (theChars.length==13) {
			if (!isbn.startsWith("978") && !isbn.startsWith("979") ){
				throw new InvalidStandardIDException("13 digit isbn must start with 978 or 979");
			}
			int checksum13=0;
			int weight13=1;
			//compute checksum
			val=0;
			for ( i=0; i<13; i++){
				val=NUMVALUES.indexOf(theChars[i]);
				if (val >=0 ){
					//valid character
					if (val==10 ) throw new InvalidStandardIDException("X not valid in ISBN 13");
					checksum13=checksum13+weight13*val;
					weight13=(weight13+2)%4;
				} else {
					//invalid char
					//should never occur
					throw new InvalidStandardIDException("invalid char");
				}
			}
			if ((checksum13%10)!=0) {
				//bad checksum
				if (fix){
					value13 =isbn.substring(0,12)+checkDigit13(isbn.substring(0,12));
				} else 
					throw new InvalidStandardIDException("bad checksum-13");
			} else {
				value13=isbn;
			}
			if (value13.startsWith("978")){
				//make 10 digit version
				
				value =value13.substring(3,12)+checkDigit(value13.substring(3,12));
			} else {
				value=null;
			}
		} else if  (theChars.length==9) {
			if (fix){
				value =isbn.substring(0,9)+checkDigit(isbn.substring(0,9));
				value13="978"+value.substring(0,9)+checkDigit13("978"+value.substring(0,9));
			} else 
				throw new InvalidStandardIDException("9-digit isbn");
		} else if  (theChars.length==12) {
			if (!isbn.startsWith("978") && !isbn.startsWith("979") ){
				throw new InvalidStandardIDException("13 digit isbn must start with 978 or 979");
			}
			if (fix){
				value =isbn.substring(3,12)+checkDigit(isbn.substring(3,12));
				value13=value.substring(0,12)+checkDigit13(value.substring(0,12));
			} else 
				throw new InvalidStandardIDException("12-digit isbn");
		} 
			
			
	}
	
	/** return 10-digit ISBN unless 979
	*/
	public String toString(){
		return toString(false);
	}
	
	/** return 13-digit ISBN unless 979 or isbn13 is false
	*/
	public String toString(boolean isbn13){
		if( isbn13 || value==null){
			return value13;
		} else {
		// try to return isbn-10
			return value;
		}
	}
	/** returns a isbn checkdigit for the first 9 digits in a string
	*/
	public static String checkDigit(String isbn){

		char[] theChars =isbn.toCharArray();
		int checksum=0;
		int weight=10;
		//clean the string, compute checksum
		int i; int val;
		for ( i=0; (i1 ); i++){
			val=NUMVALUES.indexOf(theChars[i]);
			if (val >=0 ){
				//valid character
				if (val<10){ //not a dash
					checksum=checksum+weight*val;
					weight--;
				}
			} 
		}
		if (checksum%11==0) return "0";
		return NUMVALUES.substring(11-checksum%11,12-checksum%11);
	}
	
	/** returns a isbn checkdigit for the first 12 digits in a string
	*/
	public static String checkDigit13(String isbn){

		char[] theChars =isbn.toCharArray();
		int checksum13=0;
		int weight13=1;
		//clean the string, compute checksum
		int i; int val;
		for ( i=0; (i=0 ){
				//valid character
				if (val<10){ //not a dash
					checksum13=checksum13+weight13*val;
					weight13=(weight13+2)%4;
				}
			} 
		}
		if (checksum13%10==0) return "0";
		return NUMVALUES.substring(10-checksum13%10,11-checksum13%10);
	}
	
	/**
	* @return "ISBN"
	*/
	public String IDName(){
		return "ISBN";
	}


    /** test for equality
    */
    public boolean equals(ISBN isbn)
    {
        return (value13.equals(isbn.value13));
    }
    
    /** test Strings for equality
    */
    public boolean equals(String isbnString)
    {
        try
        {
            ISBN isbn = new ISBN(isbnString);
            return equals(isbn);
        }
        catch (InvalidStandardIDException e)
        {
            return false;
        }
    }
    
    public static void main(String[] args)  {	
		if(args.length==0){
			//help message
			System.out.println("command line: java com.openly.info.ISBN [ISBN to normalize or correct]");
		} else if (!args[0].startsWith("t")){
			//normalize an isbn
			ISBN test=null;
			try{
				test = new ISBN(args[0],true);
				System.out.println(test.toString() );
			}catch(Exception e){
				System.out.println(e);
			}
			
		} else {
			//test mode
			System.out.println("doing code test");
		
			//test code
			System.out.print(" testing 0-8436-1072-7 (good): ");
			try{
				ISBN good= new ISBN("0-8436-1072-7");
				System.out.println(good );
				System.out.print(" testing 0-8436-1072-7 (13): ");
				System.out.println(good.toString(true) );
				ISBN good13=new ISBN(good.toString(true) );
				System.out.println("13->10:" );
				System.out.println(good13 );
				System.out.println(good13.toString(true) );
			}catch(Exception e){
				System.out.println("bad");
			}
			System.out.print(" testing 0-8436-1072-X (bad): ");
			try{
				System.out.println(new ISBN("0-8436-1072-X"));
			}catch(Exception e){
				System.out.println("bad");
			}
			System.out.print(" testing 0-8436-1077-X (bad): ");
			try{
				System.out.println(new ISBN("0-8436-1077-X"));
			}catch(Exception e){
				System.out.println("bad");
			}
			System.out.print(" testing 0-8436-x072-7 (bad): ");
			try{
				System.out.println(new ISBN("0-8436-x072-7"));
			}catch(Exception e){
				System.out.println("bad");
			}
			System.out.print(" testing  0940016737 (good): ");
			try{
				ISBN good= new ISBN(" 0940016737");
				System.out.println(good );
				System.out.print(" testing 0940016737 (13): ");
				System.out.println(good.toString(true) );
			
			}catch(Exception e){
				System.out.println("bad");
			}
			System.out.print(" testing  x0843610727 (bad): ");
			try{
				System.out.println(new ISBN("x0843610727"));
			}catch(Exception e){
				System.out.println("bad");
			}
			System.out.print(" testing  08436107278 (bad): ");
			try{
				System.out.println(new ISBN("08436107278"));
			}catch(Exception e){
				System.out.println("bad");
			}
			System.out.print(" testing 9780901 69066 1 (good): ");
			try{
				ISBN good= new ISBN("9780901 69066 1");
				System.out.println(good );
				System.out.print(" testing 9780901 69066 1 (13): ");
				System.out.println(good.toString(true) );
			}catch(Exception e){
				System.out.println(e);
			}
			System.out.print(" testing  9790901 69066 1 (bad): ");
			try{
				System.out.println(new ISBN("9790901 69066 1"));
			}catch(Exception e){
				System.out.println("bad");
			}
			System.out.print(" testing 978 1565 923928 (good): ");
			try{
				ISBN good= new ISBN("978 1565 923928");
				System.out.println(good );
				System.out.print(" testing  978 1565 923928 (13): ");
				System.out.println(good.toString(true) );
			}catch(Exception e){
				System.out.println(e);
			}

		}
	}


}


See also the interface StandardID and the InvalidStandardIDException classes.

Check out our web page of Java Books (with ISBN's!)

Book Search   ISBN directory   ISBN.java   Gory Details




© 2001-2005, Openly Informatics, Inc.