Excel data integrity
How to Preserve Leading Zeros in Excel Barcode Data
A leading zero is not decoration when it is part of a barcode value, SKU, product code or other identifier. If Excel removes it before generation, the barcode generator receives a different value and cannot know what the original code was supposed to be.
Updated September 13, 2026
Format the identifier column as Text before entering or pasting values that can begin with zero. Microsoft explicitly documents that Excel can remove leading zeros when numerical text is converted to a number. Verify the underlying cell value before barcode generation; a custom display format can make a zero appear on screen without necessarily restoring the original source value for downstream processing.
Why Excel removes leading zeros
Excel normally interprets digit-only input as a number. For mathematical numbers, 00123 and 123 have the same numeric value, so the leading zeros are unnecessary. For an identifier, however, those strings can mean different things.
Microsoft lists product codes among the examples where users need to preserve leading zeros and recommends storing the data as text when the original character sequence must remain intact.
Best method: set the column to Text before entering data
Select the identifier column, open Format Cells and choose Text before you paste or type the values. This tells Excel to preserve the characters rather than convert the entry into a number.
For imported data, Microsoft also provides automatic data conversion controls and Power Query options that can keep numerical text as text instead of removing zeros or converting long identifiers.
- Format the destination column as Text first.
- Then paste or import the barcode values.
- Check several cells that begin with zero.
- Save and reopen the workbook if the data came from another system, then verify again.
A displayed zero is not always the same as preserved source data
Excel custom number formats can display leading zeros for shorter numeric codes. That can be useful visually, but it is different from preserving an identifier as text. If another application reads the underlying numeric value, the displayed padding may not represent the original data you intended to exchange.
For barcode generation, prefer an actual text value that already contains every required character. This avoids making the generator infer how many zeros should exist.
Important: Formatting cannot reliably reconstruct a leading zero that was already lost unless you know the required identifier length and authoritative source. Do not guess missing digits for retail identifiers.
Watch for Excel’s long-number conversions too
Leading zeros are not the only spreadsheet risk. Microsoft documents a 15-significant-digit precision limit for numeric values and conversion to scientific notation for long digit strings. Long IDs, serials or codes should therefore be treated as text when every character matters.
This is particularly important for Code 128 workflows because internal identifiers can be longer and more flexible than fixed-length retail formats.
What BarcodeBatch does with the Excel value
BarcodeBatch intentionally does not repair a value by adding zeros, trimming spaces or replacing digits. That protects data integrity, but it also means the spreadsheet must contain the correct value before generation.
After preparing the workbook, upload it to Excel Bulk, choose EAN-13 or Code 128 for linear barcodes, review the preview and generate. If the source cell contains the intended leading zero as part of the value, it remains part of the generation input.
Common questions
Frequently asked questions
Why does Excel turn 00123 into 123?
Because Excel interprets digit-only input as a number by default, and leading zeros do not change a numeric value. Format the destination cells as Text before entering or pasting identifier data.
Can I add leading zeros back with a custom number format?
A custom format can display zeros when you know the intended width, but display formatting is not always the same as preserving the underlying identifier. For data exchange and barcode generation, a real text value is safer.
Does BarcodeBatch automatically add a missing zero?
No. BarcodeBatch does not pad, repair or guess barcode values. Fix the source data from an authoritative record before generation.
Why should long numeric codes also be text?
Microsoft documents that Excel numeric precision is limited and long values can be converted or rounded. Storing identifiers as text preserves the exact character sequence.
Sources & standards
Technical claims in this guide are checked against primary or official documentation where available.