Requirements
| Requirement | Details |
|---|---|
| Excel version | Microsoft 365 (any platform) or Excel 2016 / 2019 / 2021 on Windows or Mac |
| Internet access | Required at insert time to fetch the barcode image. Once inserted the image is saved inside the .xlsx file — no internet needed to view it later. |
| Excel Online | Fully supported. The add-in runs inside the browser. |
| Excel for iPad / Android | The task pane opens but sheet.shapes.addImage() requires Excel on Windows, Mac, or Excel Online. Mobile platforms will show a preview only. |
| Admin rights | Not required for personal sideload. Org-wide deployment requires an M365 admin. |
Install the Add-in
The add-in is distributed as a single XML manifest file. There is nothing to download or run — Excel loads the add-in directly from this server.
Option A — Personal sideload (recommended for individuals)
Works on Windows, Mac, and Excel Online with no admin rights.
-
Download the manifest file.
⬇ Download manifest.xmlThe file is generated live with this server's URL already embedded — no editing required. If your browser warns "could harm your device", click Keep — it is a plain XML text file.
-
Open Excel and open any workbook.
-
Open the Add-ins dialog.
- Excel 365 desktop (Windows/Mac) & Excel Online: click the Home tab → Add-ins button. In the store dialog that opens, click Manage your apps (bottom-left) → Upload.
-
Select the manifest file you downloaded in step 1 and click Upload.
-
Locate the button. A "Barcodes" group appears in the Home ribbon with an Insert Barcode button.
Not seeing the button? Close and reopen Excel fully, then check Home → Add-ins → Manage your apps to confirm the add-in is listed.
Option B — Organisation-wide deployment via Microsoft 365 admin centre
Deploys the add-in to all users in your organisation without individual sideloading.
-
Sign in to the Microsoft 365 Admin Centre (
admin.microsoft.com) with a Global Admin or Exchange Admin account. -
Navigate to Settings → Integrated apps → Upload custom apps.
-
Choose Provide link to manifest file and enter:
-
Select the users or groups to deploy to and click Deploy. Users will see the add-in in Excel within 24 hours (often faster).
Your first barcode
-
Type a value into a cell. For example, type
012345678901in cell A1 (12 digits — the check digit is calculated automatically for EAN-13). -
Click that cell so it is selected.
-
Open the Barcode Inserter panel from the Home ribbon → Barcodes → Insert Barcode.
-
The Value field auto-fills with the content of the selected cell. Confirm the type is EAN-13 and click Preview to verify the barcode looks correct.
▩ Barcode InserterValue12 or 13 digits (check digit auto-calculated)TypeWidth (px)Height (px)[ barcode preview ] -
Click Insert into Excel. The barcode image appears in your workbook at the top-left corner of the selected cell.
The image is embedded in the file. It is saved inside the.xlsxas a picture object — no internet connection is needed to view the barcode after saving.
Task pane guide
Value field
When the "Read value from selected cell" checkbox is ticked (default), the Value field automatically updates as you click different cells. Untick it to type a value manually without it being overwritten.
Barcode type
Choose from the three supported formats. See Barcode types for which to use.
Width and Height
These are pixel dimensions of the image inserted into the workbook. The server enforces minimum sizes for readability:
- EAN-13 / CODE128 — minimum 180 × 90 px
- QR Code — minimum dimension is derived from the QR version; the image will be square.
If you enter a value below the minimum the server silently applies the minimum.
Preview button
Fetches and displays the barcode image inside the panel without inserting it. Use this to check the value and appearance before committing.
Size & cell behaviour
Controls how the image dimensions and the target cell relate to each other:
- Custom size — resize cell to fit (default) — inserts the barcode at your specified width/height and automatically adjusts the row height and column width to match, so the image fills the cell exactly.
- Custom size — keep cell as-is — inserts at your specified size without touching the cell dimensions. The image may overlap neighbouring cells.
- Fit barcode to current cell size — reads the cell's existing dimensions and generates a barcode that fills them exactly. Width/height inputs are ignored.
Insert into Excel
Inserts one barcode for the value shown in the Value field, positioned at the top-left corner of the currently selected cell.
Bulk insert — Insert for All Selected Cells
Select a range of cells in a single column that contain barcode values, then open the task pane. A blue banner appears confirming how many rows are selected, and a green "Insert for All Selected Cells" button becomes visible.
Clicking it iterates every row in the selection: each non-empty cell's value is used to generate a barcode, which is placed on top of that cell. Empty cells are skipped. The chosen Size & cell behaviour option applies to every barcode in the batch.
- Put barcode values in column A (e.g. A1:A50).
- Select A1:A50.
- Open the task pane → choose type & size behaviour → click Insert for All Selected Cells.
- Each row gets its own barcode, positioned and (optionally) resized automatically.
Barcode types
| Type | Value format | Max capacity | Use case |
|---|---|---|---|
| EAN-13 | 12 or 13 digits | 13 digits | Retail product labels, books (ISBN), supermarket items |
| CODE128 | Any printable ASCII (space → ~) | ~80 chars for readable output | Warehouse / logistics, serial numbers, part numbers, mixed alphanumeric |
| QR Code | Any text or URL | ~200 chars (version 10, level M) | URLs, contact info, WiFi credentials, free-form text |
EAN-13 rules
- Must be exactly 12 or 13 numeric digits. Any non-digit characters are stripped.
- If you supply 12 digits, the check digit (13th) is calculated and appended automatically.
- If you supply 13 digits, the check digit is validated. An error is returned if it is wrong.
CODE128 rules
- Supports characters with ASCII codes 32–127 (space, A-Z, a-z, 0-9, common punctuation).
- Characters outside this range (e.g. accented letters, emoji) will cause an error.
- For all-digit strings of even length ≥ 4, subset C is used automatically, producing a narrower barcode.
QR Code rules
- Any Unicode text is accepted; it is UTF-8 encoded internally.
- Version is selected automatically (1–10) based on input length.
- Error correction level M is used (≈15% data recovery).
- The output image is always square. If you supply different width and height values, the larger value is used for both dimensions.
Sizes & pixels
The Width and Height fields accept pixel values. Here are practical starting points:
| Use case | Type | Width | Height |
|---|---|---|---|
| Retail label (small) | EAN-13 | 250 | 120 |
| Retail label (standard) | EAN-13 | 380 | 190 |
| Logistics / short code | CODE128 | 300 | 120 |
| Logistics / long code | CODE128 | 500 | 140 |
| QR — URL (small) | QR | 200 | 200 |
| QR — URL (print quality) | QR | 400 | 400 |
Converting Excel row/column units to pixels
Excel shows row height in points and column width in characters, not pixels. Use these approximate conversions:
- 1 Excel point ≈ 1.33 pixels at 96 dpi (standard screen)
- 1 Excel column unit ≈ 7 pixels (default Calibri 11pt font)
Example: a cell that is 60 pt tall × 20 columns wide ≈ 80 × 140 pixels.
Formula (LAMBDA) — =ADDBARCODE()
Excel 365 lets you define your own named formula using the built-in LAMBDA function.
Set it up once in Name Manager and then type
=ADDBARCODE(A1,"EAN13",300,150) in any cell — exactly like a native Excel function.
IMAGE() function.
The barcode is displayed live from the server — it is not embedded in the file.
Internet access is needed each time the workbook is opened.
For offline-embedded barcodes use the task pane instead.
One-time setup
-
Open any Excel workbook and go to Formulas → Name Manager → New.
-
Fill in the fields:
Field Value Name ADDBARCODEScope Workbook Comment (optional) Generates a barcode image in a cell Refers to see formula below -
Paste this into the Refers to field (one line — scroll right if needed):
Tip: The URL is pre-filled with this server's address. If you deploy your own worker, replace the origin with your URL. -
Click OK then Close.
Usage
In any cell, type:
=ADDBARCODE(A1, "EAN13", 300, 150)
| Argument | Description | Example |
|---|---|---|
val | Cell reference or text with the barcode value | A1 or "012345678901" |
type | Barcode type string | "EAN13", "CODE128", "QR" |
w | Width in pixels | 300 |
h | Height in pixels | 150 |
Examples
=ADDBARCODE(A1, "EAN13", 300, 150) ' EAN-13 from cell A1
=ADDBARCODE(B2, "CODE128", 400, 120) ' CODE128 from cell B2
=ADDBARCODE(C3, "QR", 250, 250) ' QR Code from cell C3
=ADDBARCODE("HELLO", "CODE128", 350, 120) ' literal value
Bulk formula — fill an entire column
Put your barcode values in column A (A1:A100), select B1:B100,
type =ADDBARCODE(A1,"EAN13",300,150) and press
Ctrl+Enter — Excel fills all 100 cells at once,
each referencing its own row in column A.
REST API
You can call the barcode API directly from any application, script, or Excel formula.
Endpoint
GET /barcode
Parameters
| Parameter | Required | Default | Description |
|---|---|---|---|
value | Yes | — | The barcode content. URL-encode special characters. |
type | No | EAN13 | EAN13, CODE128, or QR |
width | No | 300 | Output width in pixels (1–2000; minimum enforced per type) |
height | No | 150 | Output height in pixels (1–1000; minimum enforced per type) |
Response
- 200 OK — PNG image (
Content-Type: image/png) - 400 Bad Request — JSON error body (
{ "error": "..." })
All responses include Access-Control-Allow-Origin: * so the API can be called from any web page or Excel Online session.
Examples
EAN-13 barcode at 400 × 200:
CODE128 barcode:
QR code from a URL:
Use with Excel's IMAGE formula
If you have Excel 365 and prefer a live-linked barcode (not embedded), you can use the built-in IMAGE() formula directly:
=IMAGE("/barcode?value="&A1&"&type=EAN13&width=300&height=150")
=IMAGE() embeds the URL, not the pixel data. The barcode reloads from the server every time the file is opened and requires internet access to display. Use the task pane Insert into Excel button if you want the image saved offline inside the file.
Troubleshooting
The "Insert Barcode" button does not appear in the ribbon
- Close and fully reopen Excel (not just the workbook).
- Go to Home → Add-ins → Manage your apps and confirm "Barcode Inserter" is listed.
- If listed but inactive, click it to activate.
- If not listed, repeat the sideload steps and ensure you are on the correct Excel account.
Preview shows "Preview failed" or a red error message
- EAN-13 error: check that the value is 12 or 13 digits with no letters or spaces.
- CODE128 error: remove any non-ASCII characters (emoji, accented letters).
- QR error: if the text is very long (> 200 characters), it exceeds version 10 capacity — shorten the text.
- Network error: ensure the device has internet access and can reach
.
"Insert into Excel" button is greyed out or does nothing
- This can happen in Excel for iPad/iPhone — image insertion via the API is not supported on mobile. Use a desktop or web browser instead.
- Ensure the workbook is not in Protected View. Click Enable Editing if prompted.
- If Excel Online shows a permission error, make sure the workbook is saved to OneDrive or SharePoint (not a local drive).
The barcode does not scan
- Increase the image size (try 500 × 250 for EAN-13, 400 × 400 for QR).
- Ensure the image is not scaled down below 1px per module — resize the Excel shape to at least the original pixel dimensions.
- For EAN-13: verify the 12-digit value is a valid GTIN. Leading zeros matter (e.g.
012345678901≠12345678901). - For QR: try scanning with multiple apps. Some apps struggle with QR codes smaller than 2 cm × 2 cm on screen.
The add-in loads as a blank white panel
This is a browser cache issue. In Excel Online: press Ctrl+Shift+R (or Cmd+Shift+R on Mac) to hard-reload. In desktop Excel: close the task pane, wait 10 seconds, and reopen it.
The manifest was rejected during upload
- Ensure you are uploading the downloaded
manifest.xmlfile, not the raw URL. - Some corporate IT policies block sideloading — ask your IT department to deploy via the M365 admin centre instead (see Option B).
FAQ
Is the barcode image stored in the Excel file or fetched from the internet?
When you click Insert into Excel, the PNG data is fetched once and embedded as Base64 inside the .xlsx file using sheet.shapes.addImage(). The final workbook contains the full pixel data — no internet connection is needed to view the barcode after the file is saved.
Does the add-in work offline?
Internet access is required at insert time (to generate and fetch the barcode image). Once inserted and saved, the barcode is fully offline.
Can I generate barcodes in bulk?
Yes — select a column range in the task pane and click Insert for All Selected Cells. For scripted bulk generation, use the REST API from VBA or Power Automate.
Does it support EAN-8 or UPC-A?
Not directly, but UPC-A is a subset of EAN-13 (a 12-digit UPC-A with a leading zero becomes a 13-digit EAN-13). EAN-8 is not currently supported.
Can I use this without the Excel add-in?
Yes. The REST API (see above) can be called from any language or tool. The URL returns a plain PNG image.
Is my data sent to third parties?
Barcode values are sent to this server as URL query parameters in order to generate the image. No data is stored — each request is stateless. The server is hosted on Cloudflare's edge network. Do not encode confidential information (passwords, PII) in barcodes intended for public display.
The check digit I calculated doesn't match
EAN-13 uses a modulo-10 check digit with alternating weights 1 and 3. Some online calculators use a different weight order (3 then 1). This server follows ISO/IEC 15420 (GTIN-13): weight 1 for odd positions, weight 3 for even positions (counting from the left, 1-indexed). You can omit the check digit and supply only 12 digits — the correct 13th digit is always computed automatically.