條碼產生器
自研編碼器線上生成 EAN-13、UPC-A、Code 128(Code B/C 自動切換)與 Code 39 條碼:自動補校驗位並校驗,即時預覽,輸出純 SVG 字串可複製或儲存為 .svg 檔案。
瀏覽器本機執行所有計算都在你的瀏覽器裡完成,資料不會離開本機。
條碼內容
編碼器完全自研,不依賴任何第三方程式庫,也不會上傳資料:EAN-13 / UPC-A 依 GS1 General Specifications,Code 128 依 ISO/IEC 15417,Code 39 依 ISO/IEC 16388。
預覽
40063813339319511 / 7<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>
這個工具能做什麼
- 給商品做條碼標籤:輸入 12 位 EAN-13 字首,工具自動補上校驗位並校驗,匯出的 SVG 可直接放進包裝設計稿。
- 把一串數字變成能掃的碼:倉庫貨位、資產編號用 Code 128,數字串會自動切到 Code C,條碼更短更好掃。
- 驗證校驗位:拿到別人給的 EAN-13 / UPC-A 時先在這裡跑一遍,位數或校驗位不對會立刻報錯,省得打印出來才發現掃不出。
- 做內部單據或物流面單:Code 39 相容性好、印刷容錯高,適合小批次自制標籤。
範例
輸入
碼制 EAN-13,內容 4006381333931,模組寬度 2 畫素,條高 80 畫素
輸出
編碼文本 4006381333931,模組數 95,靜區 11 / 7,SVG 畫布 226 × 100 畫素,圖案以 101 開頭、101 結尾
輸入 12 位(400638133393)時會自動補上校驗位 1;輸入 13 位時校驗位必須正確,否則提示校驗位錯誤。
常見問題
生成的條碼能直接列印使用嗎?
可以,但要注意三點:模組寬度不要小於 0.264mm(GS1 對 EAN-13 的最小尺寸要求),左右靜區必須保留(工具已經把它們算進畫布寬度),列印時不要縮放成非整數倍。建議先打一張用掃碼槍實測。
EAN-13 和 UPC-A 有什麼區別?
兩者結構幾乎一樣,都是 95 個模組、共用 L/G/R 碼字表,區別在位數與校驗位權重:EAN-13 是 12 位資料 + 1 位校驗(奇數位權重 1、偶數位權重 3),UPC-A 是 11 位資料 + 1 位校驗(奇數位權重 3、偶數位權重 1)。EAN-13 首位是 0 時可以看作 UPC-A。
Code 128 的 Code B / Code C 是怎麼選的?
連續 4 位以上數字會自動切到 Code C(兩位數字壓成一個碼字,條碼更短),遇到非數字再切回 Code B;如果數字串長度是奇數,會先用 Code B 編掉一位再切,保證 Code C 始終成對處理數字。
為什麼 Code 39 只支援大寫字母?
Code 39 的字元集就是數字、大寫字母和 - . 空格 $ / + % 共 43 個字元,沒有小寫字母。輸入小寫會自動轉成大寫,輸入其它字元會直接報錯,避免生成一張掃不出原值的碼。
內容會被上傳或儲存嗎?
不會。編碼、校驗和 SVG 生成全部在瀏覽器裡完成,頁面不發任何請求,也沒有服務端儲存;關閉頁面後內容即消失。
關鍵字:条形码生成条形码在线生成EAN13校验位Code128条形码UPC条形码barcode generatorean 13upc acode 128code 39svg barcodecheck digit