NDC formats: convert 10-digit to 11-digit NDCs
· updated October 31, 2026
To turn a 10-digit NDC into 11 digits, add one leading zero to whichever of its three segments is short. The result is always 5-4-2: 0002-1433-80 becomes 00002-1433-80. To know which segment is short you need the hyphens, or the package label. If you only need one converted, the free NDC converter does it and looks the package up.
Every US drug package carries a National Drug Code, and it reaches your system in whatever shape its source used. A barcode, a claim, a pharmacy feed and a person typing can hand you the same package in at least three different shapes. Lookups only work if you normalize them the same way every time.
Convert a 10-digit NDC to 11 digits
The NDC printed on a package is 10 digits, in one of three layouts. Billing and most databases want 11 digits in 5-4-2. Pad the short segment with one leading zero:
| 10-digit layout | Short segment | 10-digit example | 11-digit (5-4-2) |
|---|---|---|---|
| 4-4-2 | labeler | 0002-1433-80 |
00002-1433-80 |
| 5-3-2 | product | 50580-488-10 |
50580-0488-10 |
| 5-4-1 | package | 12345-6789-1 |
12345-6789-01 |
Without hyphens the 11-digit forms are 00002143380, 50580048810 and 12345678901. Only one zero is ever added, at the front of the short segment.
NDC segments: labeler, product, package
An NDC has three segments:
- Labeler: the company that makes, repackages or distributes the drug. Each labeler has its own code.
- Product: the drug, strength and dosage form, from that labeler.
- Package: the size and type of package.
The first two segments together (0002-1433) are the product NDC, and every package size of that product shares it. A product NDC is 4-4, 5-3 or 5-4 on the label, and pads to 5-4 (00002-1433) the same way a full NDC does.
Going back from 11 digits to 10
The reverse direction can have more than one answer. Any segment of an 11-digit code that starts with zero might be the padded one. 00002-0143-08 could have been 0002-0143-08, 00002-143-08 or 00002-0143-8, and only the product listing says which one is real. The NDC converter shows every reading and lets you look each one up.
12-digit NDCs and barcodes
There is no 12-digit NDC format in use. An NDC is 10 digits on the label and 11 in billing. A 12-digit number on a drug package is almost always the barcode, and the NDC is inside it:
- UPC-A (the usual linear barcode): 12 digits. A
3, then the 10-digit NDC, then a check digit.300021433802carries the NDC0002143380. - GS1 DataMatrix (the 2D square on prescription packages): the GTIN inside is 14 digits. A packaging indicator digit, then
03, then the 10-digit NDC, then a check digit.00300021433802carries the same NDC. To use the converter on one, paste the 10 digits after03.
To get the NDC out, drop the prefix and the check digit and keep the 10 digits in between. Those 10 digits come with no hyphens, so the layout is unknown again: 0002143380 could be 4-4-2, 5-3-2 or 5-4-1. Don’t pad the 12-digit string itself, and don’t treat it as an NDC; it only looks like one because it contains one.
A uniform 12-digit NDC has been proposed for when labeler codes run out, but it isn’t in effect. Today a 12-digit string is a barcode, not an NDC.
Unit of measure on claims
An NDC names a package, not a dose. When an NDC goes on a medical claim (837P/837I, CMS-1500 or UB-04), it travels with a quantity and a unit of measure: UN (unit), ML (milliliter), GR (gram), F2 (international unit) or ME (milligram). That NDC quantity counts what was given in those units, and it is separate from the procedure code’s billing units, which follow the procedure code’s own definition. The two often differ for the same line. Pharmacy claims use their own units.
Where conversions go wrong
Stripping hyphens too early throws away the one thing that tells you the layout. 0002143380 could be 0002-1433-80, 00021-433-80 or 00021-4338-0, and each of those pads to a different 11-digit code. Keep the hyphens until you have converted, or ask for the 11-digit form at the source.
Going from 11 digits back to 10, don’t assume there is one answer. When more than one segment starts with zero, there is more than one reading.
Store NDCs as strings. A number drops the leading zero, and the leading zero is the whole point.
And don’t treat a barcode as an NDC. Pull the 10 digits out first, then work out the layout.
A converter in a few lines
// 10-digit, hyphenated → 11-digit 5-4-2.
function toEleven(ndc10) {
const [lab, prod, pkg] = ndc10.split("-");
return `${lab.padStart(5, "0")}-${prod.padStart(4, "0")}-${pkg.padStart(2, "0")}`;
}
toEleven("50580-488-10"); // "50580-0488-10"
That is the easy direction. The hard parts are the unhyphenated input and the reverse direction, and both need the listing.
Or let the API do it
The NDC converter does all of the above in the browser, including UPC-A barcodes, and looks the package up. In your app, send whatever you have to the NDC lookup API: 11 digits, 10 with hyphens, or 10 without:
GET /v1/drugs/ndc/50580-488-10
Authorization: Bearer pw_test_…
The answer is the package and the drug it belongs to, including its RxCUI (NDC to RxCUI, and back explains which one you get), with the date it was true. A bare 10-digit code is matched against the codes as they are listed, never padded by guesswork, and a code that matches more than one drug gets a 409 instead of a guess.
Try medication search in your browser with no key, or get a sandbox key and try it with the NDCs you already have.