CAS & NDC Code Checker

Two regulated product codes with opposite properties. A CAS number can be checked — it ends in a check digit. An NDC cannot, and worse, a ten-digit NDC without hyphens has three different readings.

🔒 Your data never leaves your browser.

The two shapes overlap, so this one is worth being explicit about.

A ten-digit NDC without hyphens is three codes

The FDA assigns every NDC in one of three configurations — 4-4-2, 5-3-2 or 5-4-1 — and the hyphens are the only thing that says which. The eleven-digit form used for billing is made by padding a zero into whichever segment is short, so the same ten digits become:

Three different billing codes, which means three different products. Converters that quietly assume one configuration will be wrong roughly two-thirds of the time, and there is no way to tell from the digits — so this page shows you all three and asks for the hyphens.

The eleven-digit form is not an NDC

The NDC the FDA lists is ten digits. The eleven-digit 5-4-2 form exists for HIPAA billing. Keeping both in one column makes a single product look like two, and the padding is not reversible: a leading zero in a segment might be the padding, or might be part of the code.

CAS numbers do check themselves

The last digit is computed from the ones before it, each multiplied by its position counted from the right. That matters more than usual here, because a CAS number is otherwise meaningless-looking digits — a transposed pair is invisible to a human reader and obvious to this check.

A passing check still only says the number is well formed. Whether it names the substance on your label is a question for a CAS lookup.

CAS checks (5 rules)

CAS-C01 CAS check digit is wrong

A CAS Registry Number ends in a check digit computed from the digits before it, each multiplied by its position counted from the right. A mismatch means the number is mistyped — and since CAS numbers look like arbitrary digits, a typo is otherwise invisible.

Fix: Use the expected check digit shown, or look the substance up in a CAS source.

Source: CAS — Check Digit Verification of CAS Registry Numbers

CAS-F01 Not the shape of a CAS number

CAS numbers are two to seven digits, then two digits, then one check digit — up to ten digits in three hyphenated groups. Anything else is a different kind of identifier.

Source: CAS — Check Digit Verification of CAS Registry Numbers

CAS-H01 Written without its hyphens

CAS numbers are always presented in three hyphenated groups. Stored without them the value still identifies the substance, but it will not match anyone else’s copy in an exact string comparison, and the group boundaries stop being recoverable if a leading zero is ever lost.

Fix: Store the canonical hyphenated form.

Source: CAS — Check Digit Verification of CAS Registry Numbers

CAS-Z01 Leading zeros are not part of a CAS number

A CAS number never starts with zero. A leading zero means the value has been through a fixed-width field or a text import that padded it.

Fix: Strip the padding.

Source: CAS — Check Digit Verification of CAS Registry Numbers

CAS-V01 Valid CAS Registry Number

The shape is right and the check digit agrees. Note this says the number is well formed, not that it names the substance you think it does — that needs a CAS lookup.

Source: CAS — Check Digit Verification of CAS Registry Numbers

NDC checks (7 rules)

NDC-N01 An NDC has no check digit

Nothing in an NDC verifies itself. A tool can check the shape and the segment lengths; whether the code names a real, currently listed product is a question only the FDA NDC Directory answers.

Source: FDA — National Drug Code Database Background Information

NDC-A01 Ten digits without hyphens have three different readings

The FDA assigns NDCs in one of three configurations — 4-4-2, 5-3-2 or 5-4-1 — and the hyphens are what tell them apart. Strip the hyphens and the same ten digits pad into three DIFFERENT eleven-digit billing codes, because the zero goes into a different segment each time. Picking one is picking a drug.

Fix: Recover the hyphens from the package label or the FDA NDC Directory before converting.

Source: FDA — National Drug Code Database Background Information

NDC-E01 The eleven-digit form is a billing format, not an NDC

The NDC itself is ten digits. The eleven-digit 5-4-2 form exists for HIPAA billing and is produced by padding a zero into whichever segment is short. Storing both forms in one column makes a single product look like two.

Source: FDA — National Drug Code Database Background Information

NDC-F01 Not a valid NDC segment layout

With hyphens present, the three segments must be 4-4-2, 5-3-2 or 5-4-1 for a ten-digit NDC, or 5-4-2 for the eleven-digit billing form. Other splits mean the value has been reformatted by something along the way.

Source: FDA — National Drug Code Database Background Information

NDC-L01 Wrong number of digits

An NDC carries ten digits; the billing form carries eleven. Any other count means digits have been lost or added — a dropped leading zero from a spreadsheet being the usual cause.

Fix: Format the column as Text before exporting, and re-export from the source.

Source: FDA — National Drug Code Database Background Information

NDC-P01 Already in the eleven-digit billing form

The value is 5-4-2, so it is the padded billing form. The original ten-digit NDC cannot be recovered with certainty, because a leading zero in any segment might be padding or might be part of the code.

Source: FDA — National Drug Code Database Background Information

NDC-V01 Well-formed NDC

Segment lengths match one of the configurations the FDA assigns.

Source: FDA — National Drug Code Database Background Information

Format only. Whether an NDC names a real, currently listed product is a question for the FDA NDC Directory — this page cannot and does not answer it.