in ean-upc

EAN UPC Support

EAN/UPC/GTIN calculations for Ruby

To install the Ruby Gem

sudo gem install ean

What can it do?

– Validate UPC/EAN/GTIN identifiers

– Generate check number for UPC/EAN/GTIN identifiers

How to use

Load the gem:

require "rubygems"
require "ean"

Convert to a 14 digit GTIN:


Check whether a number is a valid 8, 12, 13, 14 EAN/UPC/GTIN number


You can also do


Given a 7, 11, 12, of 13 digits number, generates the check digit (to be added at the end.


  • Related Content by Tag