Skip to content
UniKit

Barcode generator

Generate EAN-13, UPC-A, Code 128 (automatic Code B/C switching) and Code 39 barcodes with a self-implemented encoder: check digits are computed and validated, the preview is live, and the output is a plain SVG string you can copy or save as .svg.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Barcode content

The encoder is written from scratch with no third-party library and nothing leaves your browser: EAN-13 / UPC-A follow the GS1 General Specifications, Code 128 follows ISO/IEC 15417 and Code 39 follows ISO/IEC 16388.

Show human-readable text

Preview

4006381333931
Encoded text4006381333931
Modules95
Quiet zone (left / right)11 / 7
SVG source
<svg xmlns="http://www.w3.org/2000/svg" width="226" height="100" viewBox="0 0 226 100" role="img" aria-label="ean13 4006381333931" shape-rendering="crispEdges"><rect width="226" height="100" fill="#ffffff"/><g fill="#000000"><rect x="22" y="0" width="2" height="80"/><rect x="26" y="0" width="2" height="80"/><rect x="34" y="0" width="4" height="80"/><rect x="40" y="0" width="2" height="80"/><rect x="44" y="0" width="2" height="80"/><rect x="50" y="0" width="6" height="80"/><rect x="58" y="0" width="2" height="80"/><rect x="62" y="0" width="8" height="80"/><rect x="72" y="0" width="8" height="80"/><rect x="82" y="0" width="2" height="80"/><rect x="90" y="0" width="2" height="80"/><rect x="96" y="0" width="2" height="80"/><rect x="100" y="0" width="4" height="80"/><rect x="108" y="0" width="4" height="80"/><rect x="114" y="0" width="2" height="80"/><rect x="118" y="0" width="2" height="80"/><rect x="122" y="0" width="2" height="80"/><rect x="132" y="0" width="2" height="80"/><rect x="136" y="0" width="2" height="80"/><rect x="146" y="0" width="2" height="80"/><rect x="150" y="0" width="2" height="80"/><rect x="160" y="0" width="2" height="80"/><rect x="164" y="0" width="6" height="80"/><rect x="172" y="0" width="2" height="80"/><rect x="178" y="0" width="2" height="80"/><rect x="188" y="0" width="2" height="80"/><rect x="192" y="0" width="4" height="80"/><rect x="200" y="0" width="4" height="80"/><rect x="206" y="0" width="2" height="80"/><rect x="210" y="0" width="2" height="80"/></g><text x="113" y="95" text-anchor="middle" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" font-size="13" fill="#000000">4006381333931</text></svg>

What this tool does

  • Make a retail label: enter a 12-digit EAN-13 prefix, the check digit is computed and validated for you, and the SVG can go straight into packaging artwork.
  • Turn a serial or asset number into a scannable code — Code 128 switches to Code C on digit runs, which keeps the symbol short and easy to scan.
  • Verify a check digit: run an EAN-13 or UPC-A you were given through the tool first; a wrong length or check digit fails immediately instead of on the printed label.
  • Produce internal paperwork or shipping labels: Code 39 tolerates imperfect printing and is widely supported by cheap scanners.

Example

Input

Symbology EAN-13, content 4006381333931, module width 2 px, bar height 80 px

Output

Encoded text 4006381333931, 95 modules, quiet zone 11 / 7, SVG canvas 226 × 100 px, pattern starts with 101 and ends with 101

A 12-digit input (400638133393) gets check digit 1 appended automatically; a 13-digit input must already carry the right check digit or you get a checksum error.

Frequently asked questions

Can I print the result directly?

Yes, with three caveats: keep the module width at 0.264mm or more (the GS1 minimum for EAN-13), preserve the quiet zones (the tool already includes them in the canvas width) and scale by whole numbers when printing. Test one label with a real scanner first.

What is the difference between EAN-13 and UPC-A?

They share the same structure — 95 modules and the same L/G/R code words — but differ in length and check-digit weighting: EAN-13 is 12 data digits plus a check digit weighted 1-3-1-3…, UPC-A is 11 data digits plus a check digit weighted 3-1-3-1…. An EAN-13 starting with 0 is effectively a UPC-A.

How does the encoder choose between Code B and Code C?

A run of four or more digits switches to Code C, which packs two digits into one code word and shortens the symbol; a non-digit switches back to Code B. If the digit run has an odd length, one digit is encoded in Code B first so Code C always sees digit pairs.

Why does Code 39 only accept uppercase letters?

Its character set is digits, uppercase letters and the symbols - . space $ / + %, 43 characters in total, with no lowercase. Lowercase input is uppercased for you and anything outside the set raises an error rather than producing a symbol that scans to a different value.

Is my data uploaded or stored?

No. Encoding, checksum verification and SVG generation all run in the browser; the page makes no network requests and nothing is stored server-side. Closing the tab discards the content.

Keywords:barcode generatorean 13upc acode 128code 39svg barcodecheck digit条形码生成条形码在线生成EAN13校验位Code128条形码UPC条形码

Related tools