Code 128 is one of the most common barcode formats used in business and logistics. If you need a code 128 barcode generator, the goal is usually to create a clean, scannable label for an internal ID, a shipping workflow, or an inventory system.
This complete guide explains what Code 128 is, why it is considered a high density barcode, where it is used, and how to generate code128 barcode online with best practices for printing and scanning.
What is Code 128?
Code 128 is a 1D barcode symbology that can encode a wide range of characters efficiently. It is popular because it is compact (high density) and supports different character sets, including digits, letters, and many symbols.
When people say “Code128 barcode,” they usually mean the standard Code 128 format generated by barcode tools and used in internal operations. Code 128 is not the same as UPC/EAN retail product barcodes; it is more flexible and is commonly used for non-retail workflows.
Why Code 128 is called “high density”
Density refers to how much data you can fit into a given width. Code 128 can encode data more compactly than older formats like Code 39, especially when encoding numbers. This matters for labels where space is limited.
Code sets (A, B, C) in plain terms
Code 128 includes three code sets:
- Set A: uppercase letters, control characters, and symbols
- Set B: upper/lowercase letters and symbols (common for text)
- Set C: numeric pairs (00–99), which is very compact for digits
You usually do not need to choose the set manually. Barcode libraries and generators select the right encoding automatically based on your input. The key is to keep your data clean and print the barcode at a scannable size.
Where Code 128 is used (logistics, shipping)
Code 128 is common anywhere you need a machine-readable identifier that is not limited to retail UPC/EAN rules. Typical Code 128 use cases include:
- Shipping labels: internal tracking IDs and package identifiers
- Warehouse inventory: bin labels, pallet labels, pick/pack workflows
- Asset management: equipment tags and internal asset IDs
- Manufacturing: work orders, parts tracking, and job tickets
- Documents: forms that need fast scanning and data entry
If you are specifically using code128 for shipping labels, confirm what your shipping platform expects. Some shipping standards use specific label formats beyond a simple Code 128 barcode (for example, GS1-128 with application identifiers). If your system expects those standards, follow the platform specification.
For many teams, Code 128 sits behind the scenes. It is used to reduce manual typing and speed up workflows:
Shipping and returns
Shipping teams often use Code 128 to encode a package ID or an internal order number. A worker scans the label, and the system pulls up the record instantly. This is helpful for returns processing, too: scan the label, match the order, and route the item correctly.
Warehouse picking and bin labels
In warehouses, Code 128 is used on bin labels and location tags. The encoded value might be a location like R3-A12-B07 or a bin ID like BIN-000483. Code 128 works well because it can handle letters, numbers, and separators like dashes.
Asset tags and equipment
Asset management systems often use Code 128 for equipment IDs because labels need to be compact and scannable. A typical format is ASSET-2026-01927. If the environment is harsh (heat, abrasion), choose durable label materials and test scan after mounting.
Documents and forms
Some organizations put Code 128 on forms to speed up document handling. The barcode might represent a case ID, patient record ID, or file number. The barcode reduces manual entry errors, especially when values are long.
In busy operations, scan speed and error rate both matter. Code 128 helps reduce mistakes because the scanner reads the same value every time when labels are printed correctly. That reduces rework and prevents issues caused by mistyped IDs.
For internal labels and many business workflows, a standard Code 128 barcode is enough. You create an ID in your system, generate the barcode image, and print it on a label.
How to generate (steps + checksum)
You can generate Code 128 in seconds with a barcode generator online. If you want a code 128 generator free workflow, start with our barcode tool and follow these steps.
- Open the Free Online Barcode Generator.
- Choose Code-128 (often labeled CODE128).
- Enter your value (example:
INV-2026-000381orABC123). - Click Generate to render the barcode.
- Adjust settings if needed: width, height, margin, and whether to display text.
- Download as SVG for printing or PNG for general use.
- Print one test label and scan it using your real scanner.
If you are new to Code 128, start with a short value (10–20 characters) and a larger label size. Once scanning is reliable, you can shrink the label if needed. It is easier to go smaller later than to fix labels after a big print run.
Recommended starting settings (practical defaults)
Every printer and label is different, but these defaults work well for many cases:
- Width: avoid very thin bars; increase width if scans are inconsistent
- Height: do not make it overly short; taller bars help with fast scanning
- Margin: keep enough quiet zone on both sides
- Display text: on for internal labels; optional for packaging designs
Then print one test label and scan it with the real scanner. Adjust width first, then margins, then height. Width usually has the biggest impact.
Place the barcode into a label template
After you generate a Code128 barcode, the next step is placing it into your label design or shipping template. Download SVG when possible so the barcode stays crisp. Keep the barcode inside safe margins and avoid resizing it using “stretch” handles.
If your workflow exports a PDF for printing, confirm that the barcode remains sharp in the PDF preview. A barcode that looks slightly blurry on screen often scans poorly after printing. When in doubt, print one sample label and scan it.
Example Code 128 values (copy ideas)
Code 128 is commonly used for internal identifiers. Here are practical formats that scan well and are easy for humans to read:
- Inventory:
INV-2026-000381 - Asset tag:
ASSET-01927 - Warehouse bin:
R3-A12-B07 - Order ID:
ORD-874215
Keep values consistent across your system. Consistency reduces training time and prevents scanning the wrong label in busy operations.
Checksum basics (what you need to know)
Code 128 includes a mandatory checksum (check character). The checksum helps scanners detect errors. Most barcode generators calculate this automatically.
You do not need to manually compute the checksum when using a tool like ours. What matters is that the barcode scans to the exact value you intended.
At a high level, Code 128 checksums are computed from the encoded symbols. The scanner verifies the checksum when reading the barcode. If a print defect or blur changes how bars are interpreted, the checksum can fail, which helps prevent bad data from entering your system.
This is why print quality matters even when the barcode looks “close enough” to the human eye. Small distortions can change the decode result.
If you are building an internal system, treat the barcode as a representation of your identifier. Your database should be the source of truth. The barcode should scan to the identifier exactly (including dashes and letters).
Code 128 vs GS1-128 (what shippers should know)
Code 128 is the encoding method. GS1-128 (sometimes called EAN-128) is a standards-based way of using Code 128 with specific prefixes and Application Identifiers (AIs). In logistics, labels may require GS1-128 rules so scanners can interpret fields like product IDs, batch/lot numbers, and dates.
If you are generating barcodes for internal tracking, standard Code 128 is usually enough. If you are generating labels for a customer, carrier, or a compliance workflow, confirm whether they require GS1-128 formatting. A tool can generate the barcode image, but your encoded data must match the required format for the scanner system that will read it.
One practical tip: test with the same kind of scanner used in the workflow. Some environments use handheld laser scanners, others use camera-based scanners, and print settings vary. A quick test scan on a real device catches issues like narrow bar widths, low contrast labels, or “fit to page” scaling before you roll out hundreds of labels.
Data formatting tips (avoid surprises)
- Keep IDs consistent (example:
INV-YYYY-NNNNNN). - Avoid very long strings unless you have enough label width.
- Use only characters your workflow supports. Code 128 supports many, but your downstream system might not.
- If humans will type the ID, keep it readable and avoid confusing characters.
Print/scan best practices
The barcode generator is only half the job. Print choices determine whether the label scans reliably in real conditions.
1) Print at a practical size
Code 128 can be compact, but it still needs enough width for scanners to resolve bars and spaces. If your scanner struggles, increase barcode width or shorten the encoded value. Avoid shrinking the barcode in the print dialog.
2) Keep margins (quiet zones)
Leave blank space around the barcode. Do not let borders or text touch the bars. Cropping quiet zones is a common cause of scan failures.
3) Use strong contrast
Dark bars on a light background are safest. If you use color, keep bars very dark and keep the background very light. Avoid placing barcodes on patterns or images.
4) Do not make the barcode too short
Barcode height helps scanners capture the signal. Extremely short barcodes can be harder to scan quickly, especially with handheld scanners in busy environments.
5) Thermal printers and shipping labels
Thermal printers are common for shipping and warehouse labels. Make sure you print at 100% scale and avoid “fit to page.” If bars look merged or uneven, adjust printer darkness or increase width.
6) Test like operations will test
Print one sample label, apply it to the real surface (box, envelope, bin), and scan it with the same scanner model used in operations. Test under real lighting. This catches issues like glare, curves, and low resolution.
If you need both barcodes and QR codes, keep them separated and labeled. Many teams use Code 128 for internal scanning and QR codes for customer-facing links.
7) Scanner types (why results vary)
Different scanners behave differently. Laser and CCD scanners are common in warehouses. Phone cameras can also scan 1D barcodes, but performance depends on apps and lighting. Always test using the real scanner hardware used by your team. A barcode that scans on a phone does not guarantee it will scan fast in a warehouse workflow.
8) Surface and placement
Place labels on flat areas when possible. Curved surfaces can warp bars. Glossy surfaces can add glare. If your label must go on a curve, increase width and test at typical angles.
Glare is easy to miss during design because it depends on lighting. If your labels are used under bright warehouse lights, glossy labels can reflect enough light to hide the bars from a scanner. Matte labels usually perform better. If you must use glossy material, make the barcode larger and test under bright light.
9) Troubleshooting quick fixes
- Scans sometimes: increase width and keep more quiet zone
- Scans slowly: increase height and improve contrast
- Does not scan: verify barcode type and input rules, then reprint at 100% scale
- Scans wrong value: confirm the ID source and re-check for unintended whitespace
Most scanning issues come down to size, scaling, and print quality. Start there before changing your ID format.
10) Use SVG for print when you can
If you place a barcode into a label template, vector output is usually safest. SVG keeps bar edges crisp and prevents blur when you resize. If you must use PNG, export larger and avoid enlarging it later. Printing low-resolution raster barcodes is one of the most common causes of scan failure.
11) Shipping label checklist
- Print at 100% scale (avoid auto-fit)
- Keep the label flat and avoid wrinkles
- Avoid glare (matte labels help)
- Keep the barcode away from edges and folds
- Scan a sample label using your real scanner
These checks matter because shipping workflows are time-sensitive. A label that scans slowly can become a bottleneck.
FAQs
When should I choose Code 128 over other types?
Choose Code 128 when you need alphanumeric IDs, compact labels, and broad scanner support. If your workflow requires UPC/EAN for retail, use those. For internal IDs and shipping workflows, Code 128 is often a strong default.
Is Code 128 required for shipping labels?
It depends on your carrier and platform. Some systems use Code 128 for internal identifiers. Others use specific shipping standards. Confirm requirements for your exact workflow. For many internal shipping labels, Code 128 is commonly used.
Do I need to calculate the checksum myself?
No. Barcode tools typically calculate the Code 128 checksum automatically. Your job is to ensure the scanned value matches your intended identifier.
My Code 128 barcode does not scan. What should I fix first?
Fix printing before changing data. Increase width, keep quiet zones, use strong contrast, and print at 100% scale. If you used a low-resolution raster image, switch to SVG or export a larger PNG. Then test with the real scanner.
How long can a Code 128 value be?
Technically it can be long, but scan reliability depends on print size and density. In practice, keep it as short as your workflow allows and use a label size that supports the barcode comfortably.
Is Code 128 the same as GS1-128?
They are related but not identical. GS1-128 is a standard that uses Code 128 with specific application identifiers and formatting rules. If your platform requires GS1-128, follow the specification. For general internal use, standard Code 128 is usually fine.
What characters can Code 128 encode?
Code 128 supports a wide range of characters, including letters, digits, and many symbols. In most barcode generators, you can enter typical ID strings with dashes and letters. If you have special requirements (control characters or GS1 formatting), confirm what your generator library supports.
What label size works best for Code 128?
Use the largest label that fits your workflow. Larger labels allow wider bars and clearer quiet zones. If you must use small labels, keep the encoded value short and print at high quality.
Should I show the text under the barcode?
For internal workflows, showing the text is usually helpful. It allows humans to confirm values and type them if a scanner is unavailable. For packaging designs, you can choose based on layout.
Can I generate many Code 128 barcodes at once?
Our tool is designed for single barcodes. For batch generation, teams often use scripts or dedicated barcode generator software. The best practices are the same: consistent ID format, correct type, and print testing.
Can I put Code 128 barcodes into PDFs?
Yes. The safest approach is to download SVG and place it into your design or label template, then export to PDF. This keeps edges crisp. Avoid using low-resolution JPGs for print.
Should I use a QR code instead of Code 128?
Use Code 128 when you need fast 1D scanning in operations. Use QR codes when you need to store URLs, actions, or larger payloads. Many systems use both: Code 128 for internal IDs and QR codes for customer-facing links or manuals.
What is a good ID format for Code 128 labels?
Use a consistent pattern that is easy to read and sort, such as INV-YYYY-NNNNNN orASSET-NNNNN. Keep it short enough to print clearly. Avoid spaces and avoid characters that your downstream system might not accept.
Why not use Code 39 instead?
Code 39 is simpler and widely supported, but it is usually longer for the same data. If label space is limited or you want a compact barcode, Code 128 is often a better choice. If your system requires Code 39, follow that requirement.
Can Code 128 replace UPC/EAN for retail?
Usually no. Retail checkout systems typically expect UPC or EAN formats for products. Code 128 is great for internal operations, logistics, and non-retail identifiers. Use the format your channel requires.
Does Code 128 preserve leading zeros?
Yes. Code 128 encodes the characters you provide. If your identifier includes leading zeros, keep them in the input value and verify by scanning a printed test label.
Should I include spaces in a Code 128 value?
Avoid spaces if you can. Spaces can be harder to see in human-readable text and can cause formatting issues in downstream systems. Use dashes or underscores if you need separators.
How do I verify my Code 128 barcode is correct?
The simplest verification is scanning. Print one label, scan it, and confirm the decoded value matches your intended ID exactly. If your workflow is strict, document a small verification step as part of label creation.
Can Code 128 work on very small labels?
Sometimes, but it depends on your printer and scanner. Small labels force you to use smaller bar widths, which reduces tolerance for blur and scaling. If you must use small labels, keep the encoded value short, use a high-quality printer, and test multiple samples.
Does barcode orientation matter?
Orientation affects how people scan. Place barcodes so the scanner can approach them naturally without twisting the wrist. On boxes, avoid placing the barcode across seams or folds. On documents, keep the barcode in a consistent location so operators build muscle memory.
What label material is best for Code 128?
Use a label material that matches the environment. For warehouses, labels may need abrasion resistance. For outdoor use, they may need UV resistance. The barcode itself is simple, but durability determines whether it stays scannable over time. Always test after applying labels.
Can Code 128 include hyphens and separators?
Yes. Code 128 is commonly used for IDs that include dashes, slashes, and similar separators. The best practice is to keep the format consistent and confirm that your downstream system accepts the same characters. Always verify by scanning a printed sample.
Ready to generate one? Use our Code 128 barcode generator to create a Code128 barcode and download it for printing right away.
Always test one label before printing a full batch.