How to Make an Aztec Code: A Two-Dimensional Code You Can Print Without a Quiet Zone, Compared with a QR Code Using the Same ID
How to create an Aztec Code in the browser and save it as PNG or SVG. Measured results show why the same ID shrinks from 33 modules with a quiet zone (QR code) to 23, when changing the error-correction percentage does and does not change the size, the capacity limits, and how to check that an image saved with no quiet zone still scans.
Contents
Name badges, admission tickets and the margins of documents are places where you may want a small two-dimensional code. A QR code needs a quiet zone all around it, though, so it takes up more room than you expect, and there is often hardly any space left that does not disturb the design.
The Aztec Code is one two-dimensional code you can choose in such cases. It has a concentric square finder pattern in the center and is read from the position and orientation of that pattern, so it does not need a quiet zone around it. The international standard is ISO/IEC 24778, and it is used for railway tickets (the maker of a scanning library explains that the UIC 918.3 specification designates the Aztec Code and that Deutsche Bahn online tickets use it too: barKoder’s explanation).
The Aztec Code Generator creates this code from the text you enter and saves it as PNG or SVG. Everything is processed in your browser, and the ID you enter is not sent anywhere. This article uses a registration number for a name badge, EXPO2027-A-00318, as the example. We compare its size with a QR code made from the same ID, then check how to create the code, how the error-correction percentage affects it, and whether an image saved with the quiet zone set to 0 can still be read.
With the same ID, the size including the quiet zone is about 70% of a QR code
The unit of comparison is the “module” (also called a cell): one small black or white square that makes up the code. If the module size is the same, the ratio of module counts is the ratio of printed sizes.
The specification requires a quiet zone of 4 modules around a QR code. The Aztec Code is said not to need one, so if you set “Quiet zone (modules)” to 0 in the tool, the code itself is the whole size. We generated four strings with this site’s QR Code Generator (error correction M, automatic version) and with the Aztec Code Generator (33% error correction, the default) and compared them.
| String entered | QR code (width with the 4-module quiet zone added) | Aztec Code (width with quiet zone 0) |
|---|---|---|
EXPO2027-A-00318 (16 bytes) |
25 (33) | 23 (23) |
https://www.ixam.net/ (21 bytes) |
25 (33) | 23 (23) |
https://www.ixam.net/tools/aztec-code-generator/ (48 bytes) |
33 (41) | 31 (31) |
300 × X (300 bytes) |
69 (77) | 57 (57) |
The numbers on the left of each cell are module counts, and the image at the top of the article draws the first row. The code bodies are not very different in module count, but the gap opens once the quiet zone is included. For the registration number, the QR code is 33 modules and the Aztec Code is 23, so a side is about 0.7 times as long and the area is about half.
Part of the reason short IDs fit so small is that, in this tool, the QR code side records every character uniformly as bytes. What we compared is only module counts; it does not mean the two are equally easy to read. The smallest module size that can be read depends on the printing method and the reading device.
Enter the ID and save it
From here we go through the tool’s operation step by step. The screenshots show the English interface, and the other language versions have the same layout.
1. Enter the ID
When you open the tool, the “Text or URL” field contains https://www.ixam.net/, and the preview on the right shows that code. Clear the field and enter EXPO2027-A-00318. The preview is redrawn automatically when you change the input or settings.
The line below the preview, “23 × 23 modules / 248 × 248 px / UTF-8 16 bytes”, describes the generated code. The 248 pixels come from 23 modules plus the default quiet zone of 4 modules on each side (4 × 2), which makes 31 modules, multiplied by 8 pixels per module. The tool chooses the code size to fit the input, so you never specify the module count yourself.
2. Decide the quiet zone
“Quiet zone (modules)” ranges from 0 to 20, and the default is 4 modules. For uses such as pasting into a screen or printing on white paper, leaving it at 4 keeps the code from blending with the surrounding pattern. If the design requires you to tighten it, you can reduce it to 0.
In a PNG saved with the quiet zone at 0, the code extends right to the edge of the image. Whether it can be read depends on whether you place the image on a white background or somewhere with other patterns around it, so the last section of this article checks reading.
3. Choose the module size and colors, then save
The other settings are as follows.
- Module size (px): how many pixels each module is drawn with. It ranges from 2 to 20 and affects the size of the PNG image.
- Foreground color / Background color: the colors of the code and the background. The default is black on white. Reading devices read by the difference between light and dark, so use a light background and a sufficiently dark foreground.
Press “Save as PNG” to save aztec-code.png. PNG is fine for pasting into screens or documents. For printing at an exact size, SVG is easier to handle because the module edges do not blur when you enlarge or shrink it. The printed size is “(module count + quiet-zone modules × 2) × module size”. For example, if you print a 23-module code with quiet zone 0 at 0.4 mm per module, one side is 9.2 mm. How to think about the printed size of a QR code is covered in “How to make a QR code for flyers and business cards”.
The error-correction percentage matters only when the size changes
The “Error-correction percentage” can be set to 10, 23, 33 or 50%. It is tempting to think, as with QR code error-correction levels, that a higher percentage makes the code more resistant to dirt and damage, but with the Aztec Code there is a range where changing the percentage does not change the size.
EXPO2027-A-00318 came out as 23 × 23 modules at all four percentages, with exactly the same arrangement of black and white modules. The code size grows in steps (15, 19, 23, 27, 31 … modules), so a short ID falls into the same step whether you choose 10% or 50%. The leftover room is filled with check codewords, and as a result the image is identical at every percentage.
The percentage matters when raising the setting pushes the code into the next step. The 48-byte URL was 27 × 27 modules at 10% and 23%, and 31 × 31 modules at 33% and 50%.
If you want the code even slightly smaller, lower the percentage and check whether it drops by one step. If it does not, lowering it gains nothing and only reduces resistance to damage. To check, switch the percentage without changing the input field and see whether the module count below the preview changes.
We also tested how much damage a code can take. We made images (quiet zone 0) with the lower-right corner painted white, widened the painted area step by step, and tried reading each with the reader. The 23 × 23 module EXPO2027-A-00318 could still be read with a square 8 modules on a side (about 12% of the whole) painted out, and the 31 × 31 module URL with 12 modules on a side (about 15%). This is the result for one painted spot, though, and the values change with the position of the corner and the shape of the damage. The percentage is not a guarantee of how much damaged area can still be read.
The capacity limits, in UTF-8 bytes, were as follows. The maximum a single code can hold decreases as the percentage goes up.
| Error-correction percentage | Maximum bytes |
|---|---|
| 10% | 3,581 |
| 23% | 3,063 |
| 33% (default) | 2,662 |
| 50% | 1,985 |
These values were measured with strings of A, and real strings will come out somewhat higher or lower. Japanese characters take 3 bytes each in UTF-8, so the number of characters you can fit falls to about a third. For short strings such as a registration number, you will never come near the limit. If you find yourself wanting to include long text or several items, keep them in a ledger or database and put only the number in the code; the code is then smaller and more robust to read.
Read the code saved with no quiet zone to check it
Read the saved image once before printing. Choose the saved PNG under “Image file” in the Aztec Code Reader, and reading starts immediately and shows the result in “Decoded text”. On a computer, you can also paste a copied image into the page and have it read.
The quiet-zone-0 PNG made for this article was read exactly as entered. The four strings used in the table above were also readable with the quiet zone at both 4 modules and 0. The reader decodes with a different library from the generator (ZXing-WASM), so it is unlikely that both generation and reading share the same mistake.
Note, however, that this is a result for reading the code alone inside a white image. If you place a quiet-zone-0 code where photos, ruled lines or text surround it, the reading device may confuse the surrounding pattern with the finder pattern when it searches for the center. Being able to read the image does not guarantee that the printed result will read. Read the printed piece several times with the smartphone or scanner you will actually use, changing the angle and the brightness. If in doubt, leaving a quiet zone of 1 to 2 modules errs on the safe side.
Other kinds of two-dimensional codes can be made the same way. For a narrow label where you want less height than a QR code, rMQR is a reference, and for marking tools and parts directly, see “How to Make a Data Matrix”. When you want to make dozens of codes of the same type at once from an Excel list, you can use Batch-generate Aztec Codes from CSV and print to PDF. The tools for creating and reading two-dimensional codes are collected in the 2D Code Workspace.