Code 128 barcode generatorPart of Barcode Generator →

Code 128 barcode generator for IDs, asset tags, tickets and labels

The CardDeck Code 128 barcode generator turns letters, numbers and symbols into a compact barcode that almost every scanner reads. Use it for employee and student IDs, asset tags, tickets, internal SKUs and shipping references, then download a crisp SVG or add it to a card.

AST-00412 · Code 128
QUICK ANSWER

What is a code 128 barcode?

Code 128 is a high-density 1D barcode that can encode all 128 ASCII characters, including uppercase and lowercase letters, digits and symbols. It is defined in ISO/IEC 15417, includes a modulo-103 check character, and is read by virtually every modern barcode scanner. It suits IDs, asset tags, tickets and shipping labels.

Updated October 2026 · 7 min read · By the CardDeck team
Key takeaways
  • Encodes letters, digits and symbols; numbers-only formats like EAN-13 cannot
  • Three code sets (A, B, C); set C packs two digits into each character
  • Built-in modulo-103 check character catches misreads
  • No registration needed; use any values your system needs
  • Keep a quiet zone of at least 10 times the narrowest bar on each side

What is a Code 128 barcode?

Code 128 is a linear (1D) barcode symbology that can encode the full 128-character ASCII set: uppercase and lowercase letters, digits, punctuation and control characters. It is one of the most widely used barcodes in logistics, healthcare, libraries, access control and asset management.

The symbology is specified in the international standard ISO/IEC 15417. Because it is so common, virtually every modern laser, LED and camera-based scanner reads it without special setup.

How a Code 128 barcode is built

  • Quiet zone on the left.
  • Start character, which also selects the first code set (A, B or C).
  • Data characters, each made of three bars and three spaces across 11 modules.
  • Check character, calculated from the data.
  • Stop pattern, 13 modules wide.
  • Quiet zone on the right.

Why people choose it

  • Letters and numbers. Unlike EAN-13 or UPC-A, it handles IDs such as NWL-0428 or BK-2291-A.
  • Compact. It is denser than older alphanumeric formats such as Code 39, so the same ID needs less space.
  • Reliable. The check character and the strict pattern rules make misreads rare.
  • No registration. You can use any values that suit your system.

A note on GS1-128

GS1-128 (formerly UCC/EAN-128) is a specific application of Code 128 used on shipping and logistics labels, with GS1 Application Identifiers that mark data such as batch numbers and dates. It follows extra GS1 rules. If a retailer or carrier asks for GS1-128, follow their label specification.

What are Code 128 code sets A, B and C?

Code 128 has three code sets that share the same bar patterns but assign them different characters. A barcode can switch between sets mid-way to encode data in the fewest characters.

Code set A

  • Uppercase letters, digits and punctuation.
  • ASCII control characters, such as tab and carriage return.
  • No lowercase letters.

Code set B

  • Uppercase and lowercase letters, digits and punctuation.
  • The usual choice for general text and mixed IDs.

Code set C

  • Pairs of digits from 00 to 99, each encoded as a single character.
  • Halves the width of long numeric strings, which is why it is common for numeric shipping and tracking numbers.

Switching sets

Special characters let a barcode switch from one set to another, or shift for a single character. A scanner decodes all of this automatically and outputs only your original value, so the person scanning never sees which set was used.

What CardDeck accepts

The CardDeck Code 128 generator accepts printable characters (letters, digits, spaces and symbols) up to 40 characters per barcode. That covers employee numbers, asset tags, ticket codes and internal SKUs. Control characters are rarely needed on cards and labels and are not part of the input.

How is the Code 128 check character calculated?

The Code 128 check character is a modulo-103 checksum. You take the start character's value, add each data character's value multiplied by its position, divide the total by 103 and use the remainder as the check character's value.

Step by step

  1. Take the value of the start character (103 for start A, 104 for start B, 105 for start C).
  2. For each data character, multiply its value by its position: 1 for the first character, 2 for the second, and so on.
  3. Add the start value and all the products.
  4. Divide by 103. The remainder is the check value.
  5. Encode the character with that value just before the stop pattern.

Why it matters

If a scanner misreads one bar, the recalculated checksum will almost always not match, so the scanner rejects the read and tries again instead of sending a wrong value to your system.

You never type it

The check character is part of the bar pattern only. It is not printed in the human-readable text and not sent to your system by the scanner. CardDeck calculates it for every barcode, so you only enter your value. Unlike EAN-13 and UPC-A, Code 128 has no check digit to include in your data; see the EAN-13 barcode generator for how retail check digits differ.

What size should a Code 128 barcode be?

A Code 128 barcode's width depends on its content and its X-dimension, the width of the narrowest bar. Choose an X-dimension your printer and scanner handle well, keep at least 10X of quiet zone on each side and do not make the bars too short.

Working out the width

Every Code 128 barcode is 11 modules per character, plus 35 modules for the start character, check character and stop pattern. In code set B, an 8-character ID such as NWL-0428 is 11 × 8 + 35 = 123 modules wide.

  • At an X-dimension of 0.25 mm, that is about 31 mm of bars.
  • Add 2.5 mm of quiet zone on each side (10X) for about 36 mm in total.
  • At 0.33 mm, the same barcode is about 41 mm of bars plus 3.3 mm on each side.

Long all-numeric values are narrower if the encoder uses code set C.

Height

Keep the bars tall enough to scan at a slight angle. A practical minimum is about 15% of the barcode's width, and taller is easier, especially for hand-held scanners. On an ID card, 8–12 mm of bar height is common.

Printing tips

  • Black bars on a white background.
  • SVG output, so edges stay sharp.
  • On thermal printers, use an X-dimension that is a whole number of printer dots.
  • Avoid red bars, which red-light laser scanners cannot see.

Where is Code 128 used?

Code 128 is used wherever a system needs to identify something with a short alphanumeric code: people, assets, tickets, documents and shipments. If the item is not sold at a retail checkout, Code 128 is usually the right choice.

Common uses

  • Employee ID cards for door readers, time clocks and canteen tills. Add it to an employee ID card template.
  • Student and library cards for borrowing and attendance.
  • Asset tags on laptops, tools and equipment, matched to an asset register.
  • Inventory and bin labels in stockrooms and warehouses.
  • Tickets and wristbands for event check-in.
  • Documents and files in offices, labs and clinics.
  • Shipping references and internal order numbers.

Before you choose values

  1. Check which formats your scanner or software is set to accept. Most accept Code 128 by default.
  2. Use a consistent pattern, such as a prefix and a fixed-length number (AST-00412).
  3. Avoid characters that look alike in human-readable text, such as O and 0, if people will ever type the code.
  4. Keep values unique across your whole system.

How do I generate many Code 128 barcodes at once?

Upload a CSV or Excel file with one value per row to the bulk barcode generator, choose Code 128 and download a ZIP of files or a print-ready PDF sheet. The rows per job are 25 on Free, 500 on Pro, 2,000 on Team and 25,000 on Business.

Steps

  1. Put each value in its own row, with a header such as asset_id.
  2. Format the column as Text in Excel so leading zeros survive.
  3. Upload the file and choose Code 128.
  4. Review flagged rows: empty values, duplicates or unsupported characters.
  5. Download SVG or PNG files named from your values, or a PDF sheet.

The bulk barcode generator page covers label printing and how to place barcodes on cards in the same job. For other formats, start at the main barcode generator.

Tips for large ID registers

  • Use a fixed-length number with a prefix, such as AST-00412, so every barcode is the same width and fits the same label.
  • Keep IDs in one master sheet and generate from it every time, rather than retyping values.
  • Split very large registers by site or department and run one job per file.

Code 128 vs other common barcode formats

AspectWithout CardDeckWith CardDeck
CharactersEAN-13 / UPC-A: digits onlyCode 128: letters, digits and symbols
LengthEAN-13 / UPC-A: fixed 13 / 12 digitsCode 128: variable (up to 40 in CardDeck)
DensityCode 39: wider for the same textCode 128: more compact
CheckCode 39: check optionalCode 128: mandatory modulo-103 check
RegistrationEAN-13 / UPC-A: GS1 numbers for retailCode 128: none needed for internal use
Try Code 128 Barcode free — no credit card required.Start free

How it works

  1. Enter your value

    Letters, numbers and symbols, up to 40 characters, such as NWL-0428 or AST-00412.

  2. Preview the barcode

    CardDeck adds the start pattern, check character and stop pattern for you.

  3. Download or place it

    Download SVG for print or PNG for screens, or add it to an ID or membership card template.

  4. Test with your scanner

    Print a sample at the real size and scan it with the device your team uses.

What’s included

Full character support

Uppercase and lowercase letters, digits, spaces and common symbols.

Automatic check character

The modulo-103 check is calculated and added for you.

Input validation

Unsupported characters and over-long values are flagged before export.

Vector export

SVG keeps bars crisp on labels, cards and packaging.

On ID and member cards

Add a Code 128 field to any card template and fill it from your data.

Bulk generation

One Code 128 barcode per spreadsheet row.

Free and unlimited

Static barcodes are unlimited on every plan.

POPULAR WITHRetail & InventoryEnterpriseSchools

Use cases

Employee IDs

The employee number as Code 128 for access control and time clocks.

Asset management

Tags for laptops, tools and equipment tied to your register.

Libraries and schools

Borrower cards and book labels.

Events

Ticket and wristband codes for check-in scanners.

Warehouses

Bin, location and internal SKU labels.

Frequently asked questions about code 128 barcode

Can Code 128 encode lowercase letters?

Yes. Code set B includes uppercase and lowercase letters, digits and punctuation, so values like Bk-2291a encode correctly.

How many characters can a Code 128 barcode hold?

The standard has no fixed maximum, but long values make very wide barcodes. CardDeck accepts up to 40 characters, and shorter is easier to scan.

Do I need to add a check digit to Code 128?

No. The modulo-103 check character is added to the bar pattern automatically and is not part of your value.

Is Code 128 the same as GS1-128?

No. GS1-128 is a use of Code 128 with GS1 rules and Application Identifiers for logistics labels. Plain Code 128 has no such rules.

Can phones scan Code 128?

Some phone apps can, but the default camera is built mainly for QR codes. Dedicated scanners read Code 128 reliably.

Why will my scanner not read my Code 128 barcode?

Check the quiet zones, bar height, print contrast and size. Some scanners also have Code 128 disabled in their settings, so check the scanner configuration.

Is the Code 128 generator free?

Yes. Static barcodes, including Code 128, are free and unlimited on every plan.

Works well with

All products →
Codes

Barcode Generator

A free barcode generator for barcodes your scanners already read

Codes

Bulk Barcode Generator

Bulk barcode generator: create hundreds of barcodes from Excel or CSV

Cards

Employee ID Cards

Employee ID card maker for IDs your security team can trust

Codes

EAN-13 Barcode

EAN-13 barcode generator for retail product codes

Try Code 128 Barcode free with CardDeck.

Create your Card