Barcode Generator

Generate Code 128 and Code 39 barcodes. Download as PNG.

Note: This is a simplified barcode generator for demonstration. For production use, consider using a specialized library like JsBarcode.

About Barcode

Create barcodes from text or numbers. Supports Code 128 and Code 39 formats. Download high-quality barcode images for printing or digital use.

This generator draws a barcode-style image from any text or number you type, in either a Code 128 or a Code 39 visual style, and exports it as a PNG with a white background, black bars, and the human-readable text printed underneath. Input is normalized before drawing: letters are converted to uppercase and any character outside A to Z and 0 to 9 is removed, which mirrors the character-set restrictions of classic linear barcodes.

The image is rendered on an HTML canvas at 2-pixel bar width and 100-pixel bar height, with quiet-zone padding on each side, then converted to a downloadable PNG named after your text (for example barcode-SKU1234.png). Because the whole pipeline is a canvas drawing inside the page, the text you encode never touches a server.

One honest caveat: the encoding here is a simplified bar pattern, not a spec-complete Code 128 or Code 39 symbology with checksums. That makes it ideal for visual work, packaging mockups, UI prototypes, slide decks, print templates, and placeholder labels, anywhere you need something that looks like a real barcode at print quality. If you need codes that must scan correctly at a retail checkout or in a warehouse system, generate them with a full symbology implementation and verify with a scanner before printing in volume.

How to use the Barcode
  1. 1

    Enter your text

    Type the text or number to encode. Lowercase letters are uppercased and unsupported characters are stripped automatically before drawing.

  2. 2

    Pick a style

    Choose Code 128 or Code 39 (your selection is remembered for next time), then click Generate Barcode to render the image.

  3. 3

    Download the PNG

    The barcode appears on a white card with your text printed below the bars. Click Download to save it as a PNG file.

Common use cases

Packaging and label mockups

Drop a realistic barcode onto a product box design or shelf label comp before final artwork goes to print.

UI and app prototypes

Add placeholder barcodes to a ticketing, loyalty card, or inventory app screen so reviewers see the finished layout.

Presentations and documents

Illustrate a slide about logistics, retail, or inventory workflows with a clean barcode graphic instead of a stock photo.

Print templates

Reserve correctly sized barcode space in invoice, badge, or shipping label templates before real codes are assigned.

Frequently asked questions
Which characters can I encode?

Uppercase letters A to Z and digits 0 to 9. Lowercase input is converted to uppercase, and spaces, punctuation, and symbols are removed before the bars are drawn, so check the printed text under the barcode to see exactly what was encoded.

Will a retail scanner read these barcodes?

Not reliably. The bars use a simplified pattern rather than a checksum-complete Code 128 or Code 39 symbology, so treat the output as a visual mockup. For barcodes that must scan at checkout, use a spec-compliant generator and test with a real scanner.

What is the difference between Code 128 and Code 39?

In real-world use, Code 128 is denser and supports the full ASCII set, common on shipping labels, while Code 39 is an older, simpler alphanumeric format still used in industrial and government labeling. Here the choice switches the rendering style.

What format is the download?

A PNG with a white background, black bars at 2-pixel width, and your text printed below. The file is named after the encoded text, for example barcode-ABC123.png.

Does the text I encode get sent anywhere?

No. The barcode is drawn on a canvas element inside the page and converted to a PNG locally, so product codes, serial numbers, and internal SKUs stay on your machine.

generatorimage