{
  "id": 20179497,
  "title": "Check digits explained: how barcodes catch a typo with one number",
  "url": "https://urgent.news/2026/11/15/check-digits-explained-how-barcodes-catch-a-typo-with-one-number",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-15T13:47:26.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/gotoolsonline/check-digits-explained-how-barcodes-catch-a-typo-with-one-number-1fno"
  },
  "original_language": "en",
  "account": "EAN-13 and UPC-A barcodes terminate with a digit that holds no information; it's a verification number known as the check digit. This digit helps a scanner or code detect most typing errors instantly.\n\nFor EAN-13, the process begins with the initial 12 digits. Each digit is then multiplied by either 1 or 3, alternating starting with 1 from the left. All the resulting products are summed. The check digit is the number that, when added to this sum, makes it a multiple of 10.\n\nFor example, consider the digits 400638133393. Multiplying them alternately by 1 and 3 gives: 4+0+0+18+3+24+1+9+3+9+9+9=89. The check digit is determined by subtracting the remainder of 89 divided by 10 from 10, then applying the operation again if necessary. In this case, the check digit is 1, making the full code 4006381333931.\n\nIn JavaScript, this process can be coded into a function. The function takes the first 12 digits as input, multiplies each by either 1 or 3, sums the products, and then calculates the check digit.\n\nUPC-A uses a similar method, but it starts the weighting with 3 instead of 1 for the first digit. This scheme is designed to catch any one incorrect digit, although it may not catch all swaps of two adjacent digits. Some other systems, like ISBN-10, use a different method, applying a mod 11 calculation that can identify adjacent swaps. Credit card numbers, on the other hand, use a different algorithm known as the Luhn algorithm.\n\nBarcodes are a simple yet effective system for error detection, but they're not foolproof. Other systems trade accuracy for complexity, providing stronger protection against errors.",
  "summary": "Every EAN-13 and UPC-A barcode ends in a digit that isn't data at all. It's a check digit, and it lets a scanner (or your code) reject most typos instantly. The EAN-13 rule Take the first 12 digits. Multiply them alternately by 1 and 3, starting with 1 from the left. Add it all up. The check digit is whatever brings the total up to the next multiple of 10. Example: 400638133393? digits: 4 0 0 6 3…",
  "key_points": [
    "Check digit is verification number at end of EAN-13 and UPC-A barcodes",
    "Alternating multiplication of digits (1 or 3) for EAN-13 calculation",
    "UPC-A starts weighting with 3 for first digit, catches one incorrect digit"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}