Chapter 03 of 22 Part I: Foundations of Digital Information

The Secret Language of Barcodes

Difficulty: Foundational Editorial estimate: ~45 min Prerequisites: Chapter 02

Chapter Field Guide

LABEL
  • Pattern of dark/light
  • SCANNER
  • Reads the pattern
  • COMPUTER
  • Looks up the product

Measurable Learning Outcomes

  • Compute the EAN-13 check digit using alternating weights of 1 and 3.
  • Explain how 7-module L, G, and R encodings let scanners read barcodes upside-down.
  • Trace how the first digit of EAN-13 is encoded in the L/G parity pattern of the left six digits.

Core Scientific Intuition

An EAN-13 barcode divides its width into 95 equal narrow units called modules. Guard bars at the start (101), center (01010), and end (101) let the scanner calibrate width and speed. Each digit occupies 7 modules, and the choice between L (odd parity) and G (even parity) on the left half secretly encodes the 13th leading digit while also telling the scanner which way is right-side up.

d₁₃ = (10 − ((Σ odd-pos + 3 · Σ even-pos) mod 10)) mod 10
In plain words: The 13th EAN check digit makes the alternating 1-and-3 weighted sum of all 13 digits a multiple of 10.
Units & assumptions: Positions counted 1 to 12 from the left; all symbols are decimal digits 0–9.

Worked Example

For prefix 400638133393, odd positions sum to 4+0+3+1+3+9 = 20 and even positions sum to 0+6+8+3+3+3 = 23. Weighted sum = 20 + 3(23) = 89. Check digit = (10 - 9) mod 10 = 1.

Hands-On Exploration

Interactive Laboratory

Test the concepts directly with 4 interactive panels, live controls, and visual feedback.

Open Interactive Lab →

Three Guided Projects

Structured experiments with hypotheses, boundary tests, hints, and reflection prompts.

View 3 Projects →

Source Code (6 Snippets)

Inspect byte-identical printed JavaScript blocks, download `.js` files, or test runnable blocks in the isolated sandbox.

Browse Code →

Self-Check Quiz (5 Questions)

Immediate explanations for every choice, unlimited retries, and local-only score tracking.

Take Self-Check Quiz →

Book Chapter Outline (Reference Guide)

Section headings from Volume 1 for cross-referencing with the printed book.

Show all 35 book section headings
  1. A guide to reading information with light.
  2. The Secret Language of Barcodes
  3. How a single beep leads to a product name and price.
  4. A secret alphabet of light and dark
  5. Try it with a pencil
  6. Meet the barcode pioneers
  7. Bernard Silver (1924 to 1963)
  8. Norman Joseph Woodland (1921 to 2012)
  9. From an idea to the supermarket
  10. George Joseph Laurer (1925 to 2019)
  11. Three dates that changed shopping
  12. What happens between the light and the beep?
  13. The 95-module secret
  14. Three alphabets for ten digits
  15. How a missing digit is hidden in plain sight
  16. The last digit is a guardian
  17. Sum = 83; Check digit = 7; Total = 90
  18. Build your own barcode encoder
  19. Turn bits into a picture
  20. Teach your machine to read the code
  21. Read a real picture, one row at a time
  22. Invent a checkout that knows your products
  23. Expected result
  24. Three experiments, one browser
  25. A: Build and print a pattern
  26. B: Become the scanner
  27. C: Run your miniature supermarket
  28. The mystery of the missing first digit
  29. 08 / When the machine gets it wrong
  30. Your own science-fair shop
  31. Extension challenges
  32. What you now know
  33. Answers to the detective mission
  34. Words every barcode detective should know
  35. 11. Further reading and references

Primary Sources & Further Reading

External links are provided for independent verification and deeper study. Link availability can change over time; see the Resources page for verification notes.

Source Type Link
Biographical and image archive reference: National Inventors Hall of Fame reference https://www.invent.org/inductees/bernard-silver
Biographical and image archive reference: National Inventors Hall of Fame reference https://www.invent.org/inductees/n-joseph-woodland
Biographical and image archive reference: IBM History reference https://www.ibm.com/history/george-laurer
Original patent drawings and description: US2612994 reference https://patents.google.com/patent/US2612994A/en
GS1: check digits reference https://www.gs1us.org/tools/check-digit-calculator
GS1: General Specifications and standards primary-standard https://ref.gs1.org/standards/genspecs/
GS1: GTINs and barcodes explained primary-standard https://support.gs1.org/support/solutions/articles/43000734095-how-do-gs1-gtins-and-barcodes-work-/
GS1: History of the barcode primary-standard https://support.gs1.org/support/solutions/articles/43000734073-gs1-historical-timeline
National Inventors Hall of Fame: original optical barcode reference https://www.invent.org/blog/inventors/Joseph-Woodland-Bernard-Silver
IBM: Universal Product Code reference https://www.ibm.com/history/upc
MDN: Canvas API official-docs https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API
MDN: JavaScript arrays official-docs https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array