What if you could generate UPC-A barcodes directly in Illustrator by replacing 12-digit text with vector barcode artwork? This free script creates the barcode in the same position and rotation as the original text, making it easy to integrate barcode generation into an existing packaging layout.
Download the UPC-A Barcode script from my script library, where you can also explore my other Illustrator scripts. The UPC-A script follows the same basic workflow as my EAN-13 Barcode script but generates 12-digit UPC-A barcodes.
Latest Updates for UPC-A Barcode Script
New (October 2026):
The latest version of the UPC-A Barcode script includes a new UPC-12 Print Settings dialog box with more control over barcode size and production settings. The script can now use automatic sizing based on the original text frame or a manual magnification from 80–200%. You can also control barcode height, enforce the GS1 minimum height, add quiet-zone guides, convert the human-readable text to outlines, create linked EPS files, adjust the white background margins, and enter a printer-specific bar width reduction value.

The script remembers your settings after the first run. To reopen the settings dialog box, hold Option on macOS or Alt on Windows while double-clicking UPC12Barcode.jsx. Learn how to change the UPC-12 Print Settings.
You can now select one or more 12-digit text frames before running the script. Only the selected text frames will be converted. If no text frames are selected, the script searches the entire active document for valid 12-digit text frames and replaces them with UPC-A barcodes.
Installation of UPC-A Barcode Script in Adobe Illustrator:
-
- Download the ZIP file
-
- Extract the JSX file from the ZIP file
-
- Place the UPC12Barcode.jsx file in:
-
- Win (32 bit): C:\Program Files (x86)\Adobe\Adobe Illustrator [vers.]\Presets\en_GB\Scripts\
-
- Win (64 bit): C:\Program Files\Adobe\Adobe Illustrator [vers.] (64 Bit)\Presets\en_GB\Scripts\
-
- Mac OS: /Applications/Adobe Illustrator [vers.]/Presets.localized/en_GB/Scripts
-
- Place the UPC12Barcode.jsx file in:
-
- Restart Illustrator
-
- The script should be visible now under File > Scripts > UPC12Barcode
Note: The OCRB Std font also needs to be installed on your computer. This font is available at Adobe Fonts.
To improve your workflow, I recommend recording an action. I covered this method in my previous posts.(here and here).
Generate a UPC-A Barcode in Illustrator
Create one or more text frames containing valid 12-digit UPC-A numbers in an open Illustrator document, and then run UPC12Barcode.jsx.
If you select one or more valid 12-digit text frames before running the script, only those text frames are converted. If no text frames are selected, the script searches the entire active document for valid 12-digit text frames and replaces them with UPC-A barcodes.

The generated barcode keeps the placement and rotation of the original text frame, so you can use rotated text as a barcode placeholder in your packaging layout.

Change the UPC-A Barcode Settings
The UPC-12 Print Settings dialog box appears automatically the first time you run the updated script. After that, the script remembers your choices and runs without displaying the dialog box.
To reopen the settings dialog box:
- Locate UPC12Barcode.jsx.
- Hold Option on macOS or Alt on Windows.
- While holding the key, double-click the script.
- Change the settings, and then click OK.

The dialog box also lets you:
- Convert the human-readable text to outlines.
- Add quiet-zone guides.
- Save barcodes as linked EPS files instead of embedding them in the Illustrator document.
- Remove the white background rectangle.
- Adjust the background margins.
- Enter a printer-specific bar width reduction value.
Click Restore Defaults to return all settings to their original values.
Control the Size of the UPC-A Barcode
The script provides two ways to control barcode width.
Auto-detect from text frame uses the width of the original 12-digit text frame to determine the barcode magnification. The script keeps the result within the supported 80–200% magnification range.
Manual magnification lets you choose a specific magnification from 80–200%, independently of the original text-frame width. At 100% nominal size, the UPC-A bars are 31.35 mm wide. With 2.97 mm quiet zones on both sides, the total width is 37.29 mm. The nominal bar height is 22.85 mm.
You can also control the barcode height. By default, Enforce GS1 minimum height is turned on. If you need a custom height, turn off this checkbox and enter your own height settings.
Tip: A normal double-click runs the script with your saved settings. Use an Option-double-click on macOS or an Alt-double-click on Windows only when you need to change them.
Check the Checksum Digit in Your UPC-A Barcode
The final digit of a UPC-A number is a checksum digit calculated from the preceding digits. Before creating a barcode, the script checks whether the supplied checksum is correct.
If the checksum is incorrect, the script displays an alert with the expected checksum digit. However, do not simply replace the final digit without checking the original UPC-A number. The warning tells you that the number is inconsistent, not which part of the supplied data is wrong.

UPC-A and Layers
The generated barcode stays on the same layer as its source text, as illustrated in the GIF below.

Text frames on locked or hidden layers are ignored. This prevents the script from changing content on layers that you have intentionally protected or hidden.

Why a UPC-A Barcode May Still Fail to Scan
Creating correctly structured UPC-A artwork is only part of the process. The final printed barcode can still be affected by print quality, colors, quiet zones, barcode height, placement, packaging materials, distortion, and the shape of the package.
GS1 recommends checking these factors when evaluating barcode quality. A successful scan or online decode confirms that the encoded number can be read, but it does not replace verification of the final printed barcode.
Before sending your packaging to print
For broader guidance on barcode size, colors, placement, printing, and quality, see GS1’s 10 Steps to Barcode Your Product.
- Check the print quality. Smearing, broken bars, wrinkles, and other print defects can reduce readability.
- Use suitable colors. Use dark bars on a light background and avoid red, orange, pink, and similar colors for the bars.
- Protect the quiet zones. Keep text, borders, patterns, and other graphics outside the required clear areas.
- Preserve the barcode dimensions. Do not stretch, skew, or warp the barcode.
- Consider the package shape and orientation. Placement is especially important on cans, bottles, and other curved packaging.
- Verify the final printed barcode. A successful scan or online decode is useful, but it does not replace professional barcode verification.
For production work that requires formal verification, GS1 recommends measuring the printed barcode with an ISO/IEC-compliant barcode verifier.
Using the UPC-A Barcode Script with Data Sets and Batch Actions
Several users have asked whether the UPC-A Barcode script can work with Illustrator datasets and Batch actions.
The script does not cycle through datasets directly. If you use datasets, first run a Batch action that saves each dataset as a separate Illustrator document. Then run the UPC-A Barcode script as part of a second Batch action on those saved documents.
Because the script remembers your UPC-12 Print Settings, subsequent runs can use the same settings without reopening the dialog box.
This workflow creates separate files with their corresponding UPC-A barcodes already generated.


I hope the updated UPC-A Barcode script makes barcode creation in Illustrator faster and more reliable, especially for packaging workflows. If you use the script, I’d be glad to hear how it works for you and what you would like to see improved next.




12 Responses
This is awesome! Thank you so much for taking the time to post both the UPC-12 and the EAN-13 barcode scripts for AI. I have a few clients who generate barcodes on old software and can’t export said barcodes to attach to the art for printing. It was a real inconvenience and we had to scan the strips of barcodes to add to art. Uugh…. this is a terrific solution.
Thank you, Kimberly. It´s so lovely to hear that this script is an excellent solution for your challenges.
I was searching for a way to quickly generate multiple vector UPC-A barcodes and automate it in a way that would reduce human error. I found this script and I think it’s awesome. Thanks!
PS: I was able to mod the script to use the typeface I want for the barcode number text. I just changed the name of the typeface in the script and adjusted the font size variable by the difference between the script’s original typeface and the one I was switching to. Works great!!!
Thank you for this comment, Jacob.
It’s nice to get feedback and see that what I do benefits people. I’m glad that you are happy with thе UPC-A barcode script and that you were able to easily modify the scripts to make it work according to your needs. Great job!
Hi Katja,
Last week I did a sheet of 125 unique barcodes using your script. My proofreader tested them and they all worked! However, 5-10 didn’t scan right away.
This week I did another sheet of 64 barcodes and 17 of were picky. I got 5 of them to scan but the other 12 wouldn’t scan at all. (That’s about a 27% error margin).
I generated one of the barcodes using my barcode software (Easy Barcode Creator – it can only make 1 at a time though) and the bars of the barcodes didn’t match up.
So is it possible that I’m doing something wrong or is it that the script is just not perfectly precise? It would be a real shame if this didn’t work. I wouldn’t be able to use the script if it’s not reliable. We’re so close to this awesome solution!!!
Please advise. Thanks!
Hi Jacob
Thank you for the report on this issue. I looked at the problem and found the cause. I adjusted the code now and updated it on my webpage.
Hi Katja,
I tested the updated script to generate all 189 of my barcodes and they worked perfectly!!!!
Thank you so much!!!
Thank you so much for this! You are a lifesaver!
This is amazing – is there a way to add to the script not to add the white background bottom layer to the group?
Hi Sammi, thanks! 😊
Quick question—do you always prefer the script without the white background, or would it be helpful to have an option to toggle it on or off?
Been wrestling with Illustrator’s page setup limitations for a while—this script sounds like exactly what I need. The “flexible way to configure” part is key; my projects always end up needing custom page sizes and numbering that the default panels can’t handle.
Thanks for your comment. That’s exactly the kind of Illustrator limitation PageIndexer was made to help with. I’m currently improving the script, and I’ll be publishing an updated version soon that makes it even more flexible.