1001Ferramentas
๐Ÿ“ŠValidators

EAN-8 Validator

Validate EAN-8 (8-digit) barcode used on small packaging.

EAN-8 validation: the small-package barcode

An EAN-8 is the eight-digit member of the GS1 barcode family, designed specifically for products too small to fit a full EAN-13 on their packaging โ€” chewing gum, lipsticks, single-cigarette packs, perfume samples, candy bars, eye-drop bottles. The standard, like its big brother, is published as ISO/IEC 15420, and the prefix space is allocated and policed by GS1 at country level. Validating an EAN-8 means proving the length is exactly 8 digits, every character is 0-9, and the trailing check digit matches the weighted mod-10 sum of the first seven.

This page does the check entirely in your browser. Unlike EAN-13, an EAN-8 is not a free-form code that any GS1 member can mint โ€” the issuing office cherry-picks individual numbers and assigns them one at a time, because the namespace is tiny (10 million slots worldwide, of which a third are reserved for ISBN/ISSN and in-store use).

The mod-10 algorithm (weights start at 3)

Take positions 1 through 7. Multiply alternately by weights 3, 1, 3, 1, 3, 1, 3 โ€” note that the first weight is 3, not 1 as in EAN-13. Sum the seven products, take the remainder modulo 10, and the check digit is (10 - remainder) mod 10. The outer mod 10 covers the case where the remainder is 0.

// 73513537 โ€” sample EAN-8
digits = [7,3,5,1,3,5,3]
sum    = 7*3 + 3*1 + 5*3 + 1*1 + 3*3 + 5*1 + 3*3
       = 21 + 3 + 15 + 1 + 9 + 5 + 9 = 63
dv     = (10 - 63 % 10) % 10 = (10 - 3) % 10 = 7
// EAN-8: 73513537

The "weights start at 3" detail is a frequent bug โ€” a developer who reuses the EAN-13 routine on an EAN-8 will silently miscompute every check digit. Always double-check the first weight when porting code.

EAN-8 vs EAN-13 vs UPC-E

All three are short product barcodes, but the engineering trade-offs differ. EAN-13 is the default โ€” 13 digits, large namespace, cheap to allocate, but needs roughly 31 mm ร— 25 mm at 100% magnification to scan reliably. EAN-8 trades namespace for compactness: 21 mm ร— 17 mm minimum, enough to wrap around a lipstick or a stick of gum. UPC-E is the North American equivalent โ€” also 8 digits, but technically a compressed form of UPC-A (zeros are stripped according to a fixed pattern) rather than an independent allocation. EAN-8 and UPC-E are not interchangeable: a scanner that reads both treats them as different symbologies.

Who gets to use EAN-8 (and what it costs)

Because the namespace is so small, GS1 Brasil, GS1 Germany and the other national offices reserve EAN-8 for products that physically cannot fit an EAN-13 โ€” typically items where the printable surface is under 40 cmยฒ. The applicant must justify the request and accept a per-code fee considerably higher than the bulk EAN-13 prefix. In practice, every EAN-8 you see in a Brazilian supermarket โ€” a tiny tube of Carmed lip balm, a single Halls cough drop โ€” was individually requested and paid for.

  • 789, 790 โ€” Brazil (same prefix block as EAN-13, allocated by GS1 Brasil).
  • 40-44 โ€” Germany.
  • 30-37 โ€” France.
  • 50 โ€” United Kingdom.
  • 200-299 โ€” internal / in-store namespace, never sold to consumer marketplaces.

When (not) to ask for an EAN-8

Sellers sometimes ask GS1 for an EAN-8 just to "look smaller". The request is usually refused. Legitimate use cases include: lipsticks and pencil cosmetics, single-stick gum, perfume sampler vials, eye-drop dispensers, single-tea-bag sachets, electronic-cigarette pods. If your product has 40 cmยฒ or more of flat printable surface, GS1 will direct you to EAN-13 โ€” which is also cheaper per code.

Pitfalls and tooling

  • Wrong weight pattern: starting at 1 instead of 3 โ€” the single most common porting bug.
  • Confusing EAN-8 with EAN-13: an 8-digit code is not a truncated EAN-13. The two namespaces are managed separately and may collide if you treat them as the same.
  • UPC-E expansion: never feed a UPC-E to an EAN-8 validator. UPC-E has its own zero-suppression rules.
  • Internal codes: the 2xx prefix block is for in-store use (random-weight produce, deli labels). Marketplaces and supermarket chains reject them.
  • Generation libraries: JsBarcode, bwip-js and python-barcode all support EAN-8 โ€” pass a 7-digit body and the library will compute the DV.

FAQ

Is there a physical minimum size? Yes โ€” about 21 mm ร— 17 mm at 100% magnification with adequate quiet zones, so it can wrap small cylinders like lipsticks and lip-balm tubes.

Does EAN-8 replace EAN-13? No. EAN-8 is reserved for products too small for EAN-13; on larger packaging GS1 mandates EAN-13.

Do Brazilian retailers accept EAN-8? Yes โ€” the same laser, CCD and 2D imager scanners read both EAN-8 and EAN-13, and supermarket PoS systems treat them transparently.

Is EAN-8 the same as UPC-E? No. Both are 8 digits but EAN-8 stands alone, while UPC-E is a compressed form of UPC-A โ€” different decoding logic.

Why is each EAN-8 more expensive than an EAN-13? Because the namespace is far smaller (~10 million slots vs trillions for EAN-13), GS1 prices individual EAN-8s higher to ration the scarce resource.

Related Tools