Convert EAN-8 to EAN-13

jrn picture jrn · Jun 3, 2012 · Viewed 8.4k times · Source

I have an 8 digit EAN code which I would like to convert to an EAN-13 code.
Do you know of any algorithm on how to calculate this?

Or is it simply adding five zeros to the beginning of the EAN-8?
E.g. EAN-8(1234 5678) becomes EAN-13(00000 1234 5678)?

Answer

mjfroehlich picture mjfroehlich · Mar 20, 2014

Adding five leading zeros to a valid EAN-8 will give you a valid EAN-13.

EAN-8 is just another name for GTIN-8, and EAN-13 is another name for GTIN-13. You can always convert shorter GTINs to longer GTINs by left-padding them with zeros, see http://en.wikipedia.org/wiki/Global_Trade_Item_Number#Format.