UPC-A check digit
The product number 01234567890 gets check digit 5, so the full UPC-A reads 012345678905. Paste a complete twelve-digit code from a partner file or scanner to see whether its last digit is right. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Number
- 01234567890
- Calculation mode
- Compute
- Input
- 01234567890
- Check digit
- 5
- With check
- 012345678905
Use compute mode when you hold only the eleven-digit product number and need the digit for a label, database, or barcode generator; use validate mode when a partner, scanner, or form submits a full twelve-digit code and you need a clear valid flag plus the expected digit for error messages.
How a UPC-A number is built
A UPC-A code always has twelve digits. The first eleven are the product number, usually a GS1 company prefix followed by an item reference, and the twelfth is the check digit. That last digit exists so that a single wrong digit, typed or scanned, makes the whole code fail instead of pointing at another product. The rule weights the digits in odd positions by three and those in even positions by one, adds them, and picks the digit that rounds the total up to a multiple of ten. Seen from the other side, a complete code is valid when its weighted sum, check digit included, is already a multiple of ten.
When to compute and when to validate
Compute when you hold only the eleven-digit product number and need the last digit for a label, a database record or a barcode generator. Validate when a partner, a scanner or a web form hands you all twelve digits: you get a clear valid or invalid answer plus the digit that was expected, which makes a useful error message. Catalog teams often run every UPC in an export through this check and set aside the rows that fail. The most common slips are entering twelve digits when computing, leaving a hyphen or space in the code, or pasting a thirteen-digit EAN, which this tool does not handle.
How the UPC-A check digit is calculated
A UPC-A code is always twelve digits. The first eleven form the product number (often a GS1 company prefix plus an item reference); the twelfth is the check digit. Equivalently, the full twelve-digit string including the check digit must have a weighted sum that is a multiple of ten under the same position weights.
This is the same family of mod-10 rules used across GTIN-8, GTIN-12, GTIN-13, and GTIN-14; UPC-A is specifically the twelve-digit form common on US and Canadian packaging. The algorithm is deterministic and local: no catalog lookup, no network call, and no clock.
What you can do with it
Audit UPC columns in catalog exports
Batch-validate every twelve-digit UPC in a PIM or partner CSV and quarantine rows whose check digit no longer matches the recomputed expected value.
FAQ
What is a UPC-A check digit?
It is the twelfth digit of a UPC-A code, computed with a mod-10 weighted sum so single-digit typing and scanning errors are usually caught before the code is stored or printed.
Is the UPC-A check digit tool free?
The browser tool is free and runs locally.
How is the UPC-A check digit calculated?
Reading the eleven digits from the left, multiply those in odd positions by 3 and those in even positions by 1, then add everything up. The check digit is what brings that sum to the next multiple of ten, or 0 if it already is one.
Is a UPC-A the same as an EAN-13?
They belong to the same family of check rules, but UPC-A is the twelve-digit form, also called GTIN-12, used on packaging in the United States and Canada. This tool handles only that form, not EAN-13 or ISBN.
Can I type a UPC with spaces or hyphens?
No. Only the digits 0 to 9 are accepted, and nothing is stripped silently, so you never store a half-cleaned code. A wrong length gets a clear message saying whether eleven or twelve digits were expected.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/enc/upc-check \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"number":"01234567890"}'const res = await fetch("https://api.kit.forhosting.com/enc/upc-check", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"number": "01234567890"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/enc/upc-check",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"number": "01234567890"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/enc/upc-check", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"number":"01234567890"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"number":"01234567890"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/enc/upc-check", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"number": "01234567890"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "enc.upc_check",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Retail product numbers in North America almost always end with a UPC-A check digit: eleven payload digits that identify the manufacturer and item, plus one trailing digit that proves the whole string was typed or scanned without a single-digit slip. This capability implements the standard GTIN-12 mod-10 rule used on every twelve-digit UPC-A: odd positions from the left are weighted by three, even positions by one, and the check digit is the amount needed to reach the next multiple of ten. Non-numeric input and wrong lengths fail with invalid_input instead of silent stripping, so you never store a half-cleaned code. The same pure arithmetic runs free in the browser and at the published API price.
How the UPC-A check digit is calculated
To compute it, walk the eleven payload digits from left to right with 1-based positions: multiply each odd-position digit by three and each even-position digit by one, add those products, then take the check digit as (10 minus that sum modulo 10) modulo 10. Compared with multi-symbology barcode validators, the search intent here is narrow: people who need the UPC-A check digit calculator for eleven-digit payloads, not a general EAN-or-ISBN checker.
Input contract, modes, and error behaviour
Send a number field that contains only characters zero through nine. Wrong length is an explicit error that names the mode and the length you sent—eleven for compute, twelve for validate—so client forms can show “need eleven digits” without guessing. Empty strings, missing number, and invalid mode values fail before any weighted sum runs and are not billed. Prefer compute when you mint or complete product numbers; prefer validate when you gate a lookup or import on a full code from a user or partner file. Spaces, hyphens, letters, and decimal points are rejected as non-numeric input with invalid_input so a silently stripped value never reaches storage. Mode compute is the default: the engine requires exactly eleven digits, returns check_digit as a one-character string, and returns with_check as the twelve-digit UPC-A you can print or persist. Mode validate requires exactly twelve digits; the response reports valid true when the trailing digit matches the recomputed expected_check_digit, and always includes payload (the first eleven digits), check_digit, expected_check_digit, and length twelve. Alias keys such as digits, upc, and code are accepted for the same payload field so integrations that already speak “upc” do not need a rename. Because the path is pure parse with no clock, random source, or network, the same JSON body always yields the same JSON result on the free browser tool and on the API at $0.002 per successful request.
Where UPC-A check digits fit real workflows
Catalog and PIM teams receive eleven-digit internal product numbers and must append the official UPC-A check digit before printing shelf labels or pushing to marketplaces that reject invalid GTINs. Warehouse scanners and receiving apps validate twelve-digit codes at the dock so a single transposition does not create a phantom SKU and a stock mismatch. Data-quality jobs walk every UPC column in a CSV export, call validate mode, and quarantine rows where valid is false—catching both human edits and off-by-one bugs in generators. E-commerce onboarding forms can recompute expected_check_digit and show a friendly correction when a seller pastes a code with a mistyped last digit. Do not treat a passing UPC-A check as proof of brand ownership or GS1 registration; it only proves the mod-10 digit is consistent with the payload under the standard weights.
Integration use cases
Complete an 11-digit product number for labels
Call compute mode with the eleven-digit payload, store with_check, and feed the twelve-digit UPC-A into your barcode printer or marketplace listing.
Validate scanned or typed UPC-A at entry
When a scanner or form submits twelve digits, call validate mode and block lookup when valid is false, showing expected_check_digit to help correct a single mistype.
Technical questions
How do I compute a UPC-A check digit with this API?
POST with number set to exactly eleven digits and mode compute (or omit mode). The response includes check_digit and with_check (the full twelve-digit UPC-A).
How do I validate a full twelve-digit UPC-A?
POST with the twelve-digit string and mode validate. The response includes valid, check_digit, expected_check_digit, and payload (digits without the last one).
What happens with wrong length, letters, or hyphens?
Non-numeric input and lengths other than eleven (compute) or twelve (validate) are rejected with invalid_input. Failed validation tasks are not billed.