Click here to Skip to main content
11,932,103 members (47,985 online)
Click here to Skip to main content
Add your own
alternative version


43 bookmarked

How to Generate Check Digits and verify your barcodes

, 28 Sep 2006 CPOL
Rate this:
Please Sign up or sign in to vote.
Generates Check Digits and alows you to verify proper scan of a barcode

Sample Image - BarcodeCheckDigAndVerify.png


This only does 12 digit barcodes for now. if your interested in how this works go to whichi is where I got most of my information. I just thought it would be nice to have a quick function to do the math for me and figured I should share Wink | ;)

a basic summary goes something like this:

To figure out what the chekdigit is suposed to be add together all of the odd digits and multiply by 3, then add all the even digits and add to the last result. Then find the number that when added to that makes it evenly divisible by to (10-(total mod 10))

To make sure a barcode is valid just do the same math but at the end say (total mod 10)==0

Its fairly basic but seems a little backwards on a string since they are zero based arrays. You just swap evens for odds


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior)
United States United States
PC Programmer/Analyst

You may also be interested in...

Comments and Discussions

Generalthanks for this nice work Pin
Rola /anglian/12-Jun-07 0:59
memberRola /anglian/12-Jun-07 0:59 
GeneralRe: thanks for this nice work Pin
Polymorpher12-Jun-07 7:49
memberPolymorpher12-Jun-07 7:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.151126.1 | Last Updated 28 Sep 2006
Article Copyright 2006 by Polymorpher
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid