Skip to main content

Barcode Generator

Generate barcodes in Code 128, EAN-13, and Code 39 formats. Download as SVG or PNG for print and digital use.

Ad (leaderboard)
Format notes: Code 128: ASCII 32-127 | EAN-13: 12-13 digits | Code 39: A-Z, 0-9, -.$/+%

 

Enter data and click Generate

Rate this tool
0.0 / 5 · 0 ratings

Embed This Calculator

Add this calculator to your website for free. Copy the single line of code below and paste it into your HTML. The calculator auto-resizes to fit your page.

<script src="https://calchammer.com/embed.js" data-calculator="barcode-generator" data-category="everyday"></script>
data-theme "light", "dark", or "auto"
data-values Pre-fill inputs, e.g. "amount=1000"
data-max-width Max width, e.g. "600px"
data-border "true" or "false"
Or use an iframe instead
<iframe src="https://calchammer.com/embed/everyday/barcode-generator" width="100%" height="500" style="border:none;border-radius:12px;" title="Barcode Generator Calculator"></iframe>

Preview

yoursite.com/blog
Barcode Generator Calculator auto-resizes here
Ad (in_results)

How to Use the Barcode Generator

Enter the text or numeric data you want to encode in the input field and select the barcode format from the dropdown. Code 128 accepts any printable ASCII character (letters, numbers, symbols), EAN-13 requires exactly 12 or 13 digits (the check digit is calculated automatically if you provide 12), and Code 39 supports uppercase letters, digits, and a few special characters (dash, period, space, dollar sign, forward slash, plus, and percent). Click "Generate Barcode" to create the barcode, which renders as a scalable SVG image below.

Once generated, download the barcode as an SVG file for vector graphics applications like Adobe Illustrator, Inkscape, or print layouts, or as a high-resolution PNG image for web use, documents, and presentations. The PNG is rendered at 3x the display size for crisp output on high-DPI screens and print. The barcode includes a text label below the bars showing the encoded data for human verification.

Ad (in_content)

Understanding Barcode Formats

Barcodes encode data as patterns of parallel bars and spaces of varying widths. Different barcode formats, called symbologies, use different encoding schemes optimized for specific use cases. The three formats supported by this generator cover the most common requirements: Code 128 for general-purpose text encoding, EAN-13 for retail product identification, and Code 39 for industrial and government applications. Each symbology has its own character set, density, error detection method, and scanning characteristics.

Code 128: High-Density General Purpose

Code 128 is one of the most widely used barcode symbologies, valued for its compact size and ability to encode the full ASCII character set. Developed by Computer Identics Corporation in 1981, it uses three code sets (A, B, and C) that can be mixed within a single barcode to optimize encoding. Code Set A includes control characters and uppercase letters, Code Set B covers standard printable characters (ASCII 32-127), and Code Set C encodes pairs of digits for maximum numeric density. This generator uses Code Set B, which handles the most common data types. Code 128 includes a modulo-103 checksum for error detection, making it highly reliable for shipping labels, asset tracking, and logistics applications.

EAN-13: International Product Identification

EAN-13 (European Article Number) is the international standard for retail product barcodes, managed by GS1. It encodes exactly 13 digits: a country prefix (2-3 digits), a manufacturer code, a product code, and a check digit. The first digit determines the parity pattern used for the left-side encoding, which is how EAN-13 encodes 13 digits using only 12 directly encoded digit positions. When you provide 12 digits, this generator automatically calculates the correct check digit using the weighted sum algorithm. EAN-13 is the barcode you see on virtually every retail product worldwide and is equivalent to the UPC-A barcode used in North America, with an additional leading digit.

Code 39: Alphanumeric Standard

Code 39, also known as Code 3 of 9, was developed in 1974 and became one of the first alphanumeric barcode symbologies. Each character is encoded using nine elements: five bars and four spaces, three of which are wide and six narrow (hence the name "3 of 9"). The character set includes uppercase letters A-Z, digits 0-9, and special characters dash, period, space, dollar sign, forward slash, plus, and percent. An asterisk (*) is used as the start and stop character. Code 39 is self-checking (no check digit required, though one can be added), making it simple to implement. It remains popular in government, military (LOGMARS standard), automotive (AIAG standard), and healthcare (HIBC standard) applications.

Choosing the Right Format

Select Code 128 when you need to encode mixed alphanumeric data compactly, such as serial numbers, shipping codes, or inventory identifiers. Choose EAN-13 for retail product labeling that needs to comply with GS1 standards. Use Code 39 when simplicity and broad compatibility are priorities, particularly in government and industrial contexts where legacy scanners may only support this format. For the smallest barcode size with text data, Code 128 is generally the best choice due to its higher information density.

Frequently Asked Questions

What is a barcode?

A barcode is a machine-readable pattern of parallel lines that encodes data such as product numbers or text. First patented in 1952, barcodes are now used across retail, logistics, healthcare, and manufacturing for automated identification and tracking.

What is the difference between Code 128, EAN-13, and Code 39?

Code 128 encodes all ASCII characters at high density, ideal for shipping and logistics. EAN-13 is a 13-digit numeric barcode for retail products. Code 39 supports uppercase letters and digits at lower density, used in government and automotive industries.

How does Code 128 encoding work?

Code 128B encodes printable ASCII characters as patterns of three bars and three spaces totaling 11 modules. The barcode includes a start character, data characters, a modulo-103 checksum, and a stop pattern for integrity verification.

What is an EAN-13 check digit?

The 13th digit is calculated by multiplying odd-position digits by 1 and even-position digits by 3, summing the products, and finding the value needed to reach the next multiple of 10. It detects reading errors.

Can I print barcodes from this tool?

Yes. SVG output provides vector quality at any size. PNG is rendered at 3x resolution for print. Ensure adequate quiet zones, minimum 25mm width, and high contrast. Test with a scanner before mass printing.

Related Calculators

Disclaimer: This calculator is for informational and educational purposes only. Results are estimates and should not be considered professional expert advice. Consult a qualified professional before making decisions based on these calculations. See our full Disclaimer.