How It WorksPublished 12 min read

How to Calculate a JAN / EAN-13 Barcode Check Digit | Multiply by 3 and 1, Then Add — Worked Example, Excel Formula, ITF-14 and ISBN

The last digit of a JAN code (the Japanese name for EAN-13) is the “check digit”, a verification number calculated from the first 12 digits. Being able to work it out yourself helps when you only know 12 digits for a product listing, or when you want to confirm that a 13-digit code from a supplier is correct. This guide walks through the calculation — multiply from the right by 3, 1, 3, 1…, add, then subtract the last digit of the total from 10 — one digit at a time on a real 13-digit code. It also covers what the 13 digits mean (the 45/49 prefix, company prefix and item reference), how the same method works for 8-digit EAN-8, UPC-A, ITF-14 case codes, Japanese book barcodes and in-store codes, why ISBN-10 divides by 11 and uses X, Excel and Google Sheets formulas, which errors a check digit can and cannot catch, and the most common calculation mistakes.

The short answer: multiply from the right by 3, 1, 3, 1…, add, and subtract the last digit from 10

The check digit of a 13-digit JAN code is calculated from the 12 digits that come before it. The method is called “modulus 10, weights 3 and 1”, and it is the same for EAN-13 (GTIN-13, the international name for JAN), the 8-digit short version, the American UPC-A and the ITF-14 code used on shipping cartons.

  • 1. Starting from the right end (the digit just left of the check digit), multiply the 12 digits by 3, 1, 3, 1… in turn
  • 2. Add up all the products
  • 3. Subtract the last digit of the total from 10. That is the check digit
  • 4. If the last digit of the total is 0, the check digit is 0 (not 10)

Let’s calculate it for the 12 digits 456995111617. With 12 digits, this means multiplying the odd positions (counting from the left) by 1 and the even positions by 3.

Position (from left)123456789101112
Digit456995111617
Weight×1×3×1×3×1×3×1×3×1×3×1×3
Product41562791513118121

The products add up to 4 + 15 + 6 + 27 + 9 + 15 + 1 + 3 + 1 + 18 + 1 + 21 = 121. The last digit is 1, so 10 − 1 = 9. The check digit is 9 and the full JAN code is 4569951116179.

The sections below explain what the 13 digits mean, how the calculation works for other code types, the divide-by-11 method used by ISBN-10, Excel formulas, which errors a check digit catches and misses, and common mistakes. Every number in this guide was checked with the same calculation used by the JAN code check digit tool.

What the 13 digits mean: prefix, company code, item reference and check digit

A 13-digit JAN code on a Japanese product is made up of, from the left, a “GS1 prefix” (country code), a “company code”, an “item reference” and the “check digit”. Japanese businesses apply to GS1 Japan (the Distribution Systems Research Institute) for a GS1 company prefix starting with 45 or 49, and then assign their own numbers to each product after it.

Company prefix length (including 45/49)Item referenceNumber of productsCheck digit
9 digits (current standard)3 digits (000–999)1,000 items1 digit
10 digits (for businesses with few items)2 digits (00–99)100 items1 digit
7 digits (long-registered businesses)5 digits (00000–99999)100,000 items1 digit

In every combination, the code is 12 digits without the check digit, and the calculation is the same. The check digit is not something the numbering business chooses freely; once the first 12 digits are fixed, there is exactly one correct check digit.

Leading digitsMeaning
45, 49Japan (numbers allocated by GS1 Japan)
00, 01, 06–13USA and Canada (UPC written as 13 digits)
02, 20–29In-store codes (numbers used only inside one shop)
69China
880South Korea
471Taiwan
978, 979Books (ISBN)
191, 192Second row of a Japanese book barcode (classification code and price)

Why you count from the right: the same rule works for 8, 12 and 14 digits

The digits multiplied by 3 are every other digit starting with the one immediately to the left of the check digit. Counted from the left, that means even positions for a 13-digit JAN but odd positions for an 8-digit EAN-8, so it flips with the length. Counting from the right gives one procedure that works for every code length.

  1. 1

    Write out the digits without the check digit

    12 digits for a 13-digit JAN, 7 for an 8-digit EAN-8, 13 for a 14-digit ITF-14. If you have a full code and want to verify it, drop the last digit first.

  2. 2

    Multiply the rightmost digit by 3, then go left with 1, 3, 1, 3…

    The rightmost digit always gets ×3, whatever the code type.

  3. 3

    Add all the products and look at the last digit

    A total of 121 gives 1, a total of 50 gives 0. This is the remainder after dividing by 10.

  4. 4

    Subtract the last digit from 10. If it is 0, the check digit is 0

    Written as “(10 − (total mod 10)) mod 10”, a single formula covers the 0 case too.

For the EAN-8 data 4901234, from the right: 4×3 + 3×1 + 2×3 + 1×1 + 0×3 + 9×1 + 4×3 = 12 + 3 + 6 + 1 + 0 + 9 + 12 = 43. The last digit is 3, so 10 − 3 = 7 and the 8-digit code is 49012347. For 4512345 the total is exactly 50, so the check digit is 0 (45123450).

Examples by code type: EAN-8, UPC-A, ITF-14, book barcodes and in-store codes

The family of product codes known as GTINs all use the same check digit calculation, whatever their length. Here are the data lengths and a worked example for each type.

TypeTotal digitsDigits usedExample (without check digit)TotalCheck digitFull code
JAN-13 (EAN-13)131245699511161712194569951116179
JAN-8 (EAN-8)87490123443749012347
UPC-A (USA/Canada)121103600029145582036000291452
ITF-14 (case code)14131456995111617124614569951116176
ISBN-13 (book barcode, row 1)13129784101010015649784101010014
Japanese book barcode, row 213121920093015007641920093015004
In-store code with price13120212345003987550212345003985
  • UPC-A: add a 0 in front and it reads as a 13-digit EAN-13. Zero times anything is zero, so the check digit doesn’t change (036000291452 → 0036000291452).
  • ITF-14: take the 12 digits of the single-item JAN without its check digit, put an indicator digit (1–8) in front to show the pack quantity, and recalculate the check digit. Note that the JAN’s final 9 becomes a 6 in the ITF-14.
  • Japanese book barcode, row 2: “192 + 4-digit C code (classification) + 5-digit price before tax” makes 12 digits, then the check digit is added. The example is C0093 (general, hardcover, Japanese fiction) at 1,500 yen.
  • In-store codes: numbers starting with 02 or 20–29 are reserved for use inside a single shop. The example is “02 + item number 12345 + price 398 yen”, used with a till set up to read the price.

ISBN-10 divides by 11 — which is why a check digit can be X

The 10-digit ISBN found on books published up to 2006 uses a different calculation from JAN. Multiply the first 9 digits from the left by 10, 9, 8, 7, 6, 5, 4, 3, 2, add, divide the total by 11 and subtract the remainder from 11. A result of 10 is written X, and 11 is written 0.

First 9 digits of ISBN-10Weighted totalRemainder ÷ 1111 − remainderCheck digit
4-10-10100140+9+0+7+0+5+0+0+2 = 63833 (4-10-101001-3)
4-10-00007440+9+0+0+0+0+0+21+8 = 78110X (4-10-000074-X)

X is the Roman numeral for 10. Dividing by 11 gives 11 possible answers, 0 to 10, which don’t fit in one digit, so 10 alone is written as X. It is not a typo — type it as it is when searching online shops.

To convert an ISBN-10 to 13 digits, add 978 in front and recalculate the last digit with the JAN method. 4-10-101001-3 becomes 978-4-10-101001-4, and 4-10-000074-X becomes 978-4-10-000074-0. A 13-digit ISBN is itself an EAN-13 code and is printed as the first barcode on a book’s back cover.

Excel and Google Sheets formulas for the check digit

Put a 12-digit JAN code in cell A1 and enter one of these formulas in another cell. The same formulas work in Google Sheets.

TaskFormula (number in A1)
Check digit from 12 digits=MOD(10-MOD(SUMPRODUCT(MID(A1,{1,3,5,7,9,11},1)*1)+SUMPRODUCT(MID(A1,{2,4,6,8,10,12},1)*3),10),10)
12 digits to 13 digits=A1&MOD(10-MOD(SUMPRODUCT(MID(A1,{1,3,5,7,9,11},1)*1)+SUMPRODUCT(MID(A1,{2,4,6,8,10,12},1)*3),10),10)
Is a 13-digit code valid? (TRUE = valid)=MOD(SUMPRODUCT(MID(A1,{1,3,5,7,9,11,13},1)*1)+SUMPRODUCT(MID(A1,{2,4,6,8,10,12},1)*3),10)=0

MID(A1,{1,3,5,…},1) picks out the odd-position digits and multiplies them by 1, and the even positions are multiplied by 3. “Even positions from the left get 3” only holds for 12-digit JAN data. For 7-digit EAN-8 data or 13-digit ITF-14 data, swap the position lists so that the rightmost digit gets ×3.

  • Format the cells as Text before entering numbers. As numbers, leading zeros (UPC, in-store 02 codes) disappear, or the value turns into scientific notation like 4.57E+12
  • Check pasted CSV values for spaces or hyphens. MID counts a space as a character. If product names turn into garbled text when you open a CSV in Excel, see how to fix garbled CSV files
  • Using the 12-digit formula on a column of 13-digit codes ignores the 13th digit and gives a different answer

Errors a check digit catches — and errors it misses

The check digit exists to catch barcode misreads and typing errors. It can’t catch every error, though. Here is what the JAN method can detect.

Type of errorDetection rateReason / example
One digit wrong100%Multiplying by 1 or 3 never shifts the total by a multiple of 10, so the last digit always changes
Two adjacent digits swappedAbout 89% (80 of 90 cases)Missed only when the two digits differ by exactly 5 (0/5, 1/6, 2/7, 3/8, 4/9)
Two or more scattered errorsAbout 90%There is roughly a 1 in 10 chance that the last digit of the total ends up the same

For example, swapping the 9th and 10th digits (1 and 6) of 4569951116179 gives 4569951161179, which passes the check digit test because 1 and 6 differ by 5. Swapping the final 7 and 9 instead gives 4569951116197, which is flagged as invalid, and the tool suggests 4569951116179 as “the code that becomes valid if two adjacent digits are swapped back”.

A correct check digit doesn’t mean a product with that number exists. When checking a list from a supplier, use the check digit to weed out typos, then compare against the product names and specifications.

Common calculation mistakes, and what a check digit alone can’t do

  • Multiplying the leftmost digit by 3: in a 13-digit JAN the leftmost digit (the leading 4) is multiplied by 1. Starting with 3 almost always gives the wrong answer
  • Writing “10” when the total ends in 0: the check digit is always one digit, and in this case it is 0
  • Adding another check digit to a 13-digit code: if you already have 13 digits, the last one is the check digit. Remove it before recalculating
  • Using the quotient of the total ÷ 10: you need the remainder (the last digit)
  • Deleting the X of an ISBN-10 or changing it to 0: X is a valid check digit meaning 10. It changes to a different digit when you convert to 13 digits

Even with a correctly calculated check digit, a number isn’t an official JAN code by itself. Products sold in shops or online need a company prefix registered with GS1 Japan (or the GS1 organisation of your country), and the numbers must come from that range. Registration has a fee and must be renewed periodically. The only codes you can use freely without registering are in-store codes starting with 02 or 20–29, and they only work inside your own shop.

The printed barcode size also has rules. At 100% magnification, the narrowest bar of a JAN barcode is 0.33 mm and the width including the side margins is 37.29 mm; for reliable scanning, use 80–200%. Keep the margins (quiet zones) free of graphics or text, use a white or light background with black or dark bars, and test the printed code with a real scanner. Many of the checks in what to do when a QR code won’t scan apply to barcodes too.

Check it with the JAN code check digit tool, and turn it into a barcode

Enter 12 digits into the JAN code check digit and barcode maker, and it shows the 13-digit code with its check digit plus the working, laid out like the table in this guide (position, digit, weight, product). Enter 13 digits and it tells you whether the code is valid; if not, it lists candidates that become valid by swapping two adjacent digits or changing one digit. You can paste numbers with hyphens or full-width digits as they are.

  1. 1

    Enter the number

    12 digits calculates the check digit; 13 digits verifies it. If you know the type, choose JAN-8, UPC-A, ITF-14 or ISBN-10. In auto-detect mode, 12 digits are treated as a JAN-13 without its check digit, so select UPC-A explicitly for UPC codes.

  2. 2

    Calculate many numbers at once

    Paste one number per line into the batch tab, then copy all results as tab-separated text back into Excel.

  3. 3

    Make a barcode if you need one

    Choose the magnification and bar height, then save an actual-size SVG or a 300–1200 dpi PNG. Two-row Japanese book barcodes, in-store codes and ITF-14 are supported too.

The numbers you enter are calculated on your device and never sent anywhere, so you can safely check codes for products that haven’t been announced yet.

FAQ

How do you calculate a JAN / EAN-13 check digit?
Take the 12 digits before the check digit, multiply them from the right by 3, 1, 3, 1…, add the products and subtract the last digit of the total from 10. For 456995111617 the total is 121; 10 − 1 = 9, so the JAN code is 4569951116179. If the total ends in 0, the check digit is 0.
Can the check digit be 10?
Not in a JAN code. If the total ends in 0, the check digit is 0, not 10. For example, the EAN-8 data 4512345 totals exactly 50, so the check digit is 0 (45123450). Writing 10 as X only happens in the divide-by-11 ISBN-10.
Is it right to multiply odd positions from the left by 1 and even positions by 3?
Yes for a 13-digit JAN (12 data digits). The real rule, though, is “3, 1, 3, 1… starting just left of the check digit”, so for an 8-digit EAN-8 (7 data digits) and a 14-digit ITF-14 (13 data digits) the odd positions from the left are the ones multiplied by 3.
Is an ISBN ending in X a mistake?
No. A 10-digit ISBN is calculated by dividing by 11, so the check digit can be 10, which is written as the Roman numeral X. For the 9 digits 4-10-000074 the total is 78, the remainder after dividing by 11 is 1, and 11 − 1 = 10, so the check digit is X. As 13 digits it becomes 978-4-10-000074-0.
How do I calculate the check digit in Excel?
Put the 12 digits in A1 as text and enter =MOD(10-MOD(SUMPRODUCT(MID(A1,{1,3,5,7,9,11},1)*1)+SUMPRODUCT(MID(A1,{2,4,6,8,10,12},1)*3),10),10). Add A1& at the start to show all 13 digits. If the cell is a number, leading zeros disappear or it switches to scientific notation, so format it as Text.
If the check digit matches, is the number definitely correct?
Not necessarily. A single wrong digit is always caught, but adjacent swaps of digits that differ by 5 (such as 1 and 6) slip through, and errors in two or more digits pass about once in ten times. And even with a valid check digit, there may be no product with that number.
Can I make my own number, add a check digit and use it as a JAN code?
Not for products sold in shops or online. You need to register a company prefix with GS1 Japan (or your country’s GS1 organisation) and number products within it. The codes you can create freely without registering are in-store codes starting with 02 or 20–29, which only work inside your own shop.
Is the ITF-14 check digit calculated the same way as JAN?
Yes. Put the indicator digit before the 12 digits of the JAN, multiply the 13 digits from the right by 3, 1, 3, 1…, add, and subtract the last digit from 10. For a case of 4569951116179 with indicator 1, 1456995111617 totals 124, so the check digit is 6 and the code is 14569951116176. The JAN’s final 9 is not used.

Tools in this article

Related articles

How It Works13 min read

How to Calculate Your One Rep Max (1RM) | 100 kg for 10 Reps Is What Max? 7 Formulas Compared, Charts, Rep Max Table, %1RM and Training Loads by Goal

“I benched 80 kg for 8 reps, so what is my max?” “My 1RM is 100 kg, so what should I load for sets of 10?” You don’t have to attempt a true max to know your one rep max (1RM): you can estimate it from a weight you lifted and how many reps you got. This guide covers the most common formula, Epley (1RM = weight × (1 + reps ÷ 30)), how the seven well-known formulas (Brzycki, O’Conner and others) and the NSCA chart differ, why they drift apart as reps go up, a weight × reps chart, a rep max table that works backward from your 1RM, how to adjust with RIR and RPE when you didn’t go to failure, loads for strength, hypertrophy and endurance, and how to warm up and load the bar when you test a real max. Every number was calculated, not copied.

Read article →
How It Works14 min read

How to Count Horse Racing Bet Combinations | Trifecta and Trio Box, Key Horse Wheel and Formation Formulas and Charts, Multi, Bracket Quinella Pairs, Combined Odds and Losing Wins

“How many combinations is a 5-horse trifecta box?” “How many more does a multi add?” “Can I just multiply the candidates in a formation?” If you don't work out the number of combinations and the cost before you bet, you can end up with far more bets than you planned and go over budget, or win and still get back less than you spent (a “losing win”, called torigami in Japan). This guide covers the eight JRA bet types (win, place, bracket quinella, quinella, quinella place (wide), exacta, trio and trifecta): formulas and charts for boxes, key horse wheels (one or two key horses, multi, and wheeling to all runners) and formations, how to count overlapping bets in a formation, the total number of combinations and the bracket assignments for each field size, when same-bracket pairs can be bought in the bracket quinella, how to calculate combined odds and spot losing wins, how to split a budget so every winning bet pays about the same, the payout rate of each bet type, and WIN5 combinations, all with worked examples.

Read article →
How It Works14 min read

How to Calculate Decibels (dB) | Formulas and Charts for Adding, Subtracting, Averaging and Distance Attenuation, from Why 60 dB + 60 dB Is 63 dB to Background Noise Correction and Noise Standards

“If two 60 dB outdoor units run together, is that 120 dB?” “Can I average my noise readings by adding them up and dividing?” “How quiet will it be at the house next door, 10 m away?” Decibels (dB) are logarithmic, so adding or averaging them like ordinary numbers gives answers that are far off. This guide covers what dB means and its reference pressure (20 µPa), how many times stronger a dB difference is in energy, sound pressure and perceived loudness, the formula for adding levels and for n identical sources, a chart for adding two levels from their difference, the difference between the energy average and the arithmetic mean, subtracting background noise and the JIS Z 8731 corrections, distance attenuation for point and line sources and the distance at which noise falls to a target level, worked examples for outdoor units, roads and construction, typical noise levels and Japan's environmental standards, and what to watch for when measuring with a sound level meter or a smartphone — all with figures we actually calculated.

Read article →