Labeling small tools and parts where a QR code won't fit: how to make a Data Matrix and how much smaller it is than a QR code
When you want a scannable asset number on a tool, measuring instrument, small part or vial, a Data Matrix (ECC 200) prints smaller than a QR code. This guide makes one in the browser and saves it as PNG or SVG, compares module counts for the same ID (29 vs. 18 modules including the quiet zone), shows how to calculate print size, lists the capacity of rectangular symbols for narrow labels, covers non-ASCII text, and verifies the result with a reader — all measured with real output.
Contents
Think of a workshop that tracks tools and measuring instruments in a loan register, a lab that stores rows of small sample vials, or a stockroom that keeps screws and electronic components in little drawers. If you want the ID numbers in places like these to be readable by a camera or scanner, the first thing that comes to mind is probably a QR code. But try sticking a QR code on a screwdriver handle, the side of a caliper, or the cap of a vial about 1 cm across, and it takes up more room than you expected. A QR code needs a quiet zone of 4 modules around it, so even for a short number you have to reserve an area noticeably larger than the code itself.
For numbering small items like these, another 2D code, Data Matrix, is worth considering. It is also used for marking parts directly by laser engraving or stamping (direct part marking), and the GS1 guideline lists laser marking and dot peen among its printing methods (GS1 DataMatrix Guideline, section 4.2). The Data Matrix Generator turns the text you enter into a Data Matrix and saves it as PNG or SVG. Everything happens inside your browser, and the numbers you type are not sent anywhere.
Using the asset number TL-2026-0153 as the example, this article first checks how much smaller a Data Matrix is than a QR code, then walks through creating one, deciding the print size, using rectangular symbols for narrow labels, and what to watch for when you encode non-ASCII text such as Japanese.
For the same number, the width including the quiet zone is about 60% of a QR code’s
Let’s start by comparing the size of a QR code and a Data Matrix encoding the same number. The unit of comparison is the “module”: one of the small black or white squares the code is made of. The printed size is the number of modules multiplied by the size of one module, so if the module size is the same, the ratio of module counts is the ratio of physical sizes.
Encoding TL-2026-0153 (12 characters) with this site’s QR Code Generator at its default setting (error correction M) and with the Data Matrix Generator gives the result shown in the cover image. The QR code is the smallest version, Version 1, at 21×21 modules; the Data Matrix is 16×16 modules.
The difference grows once you include the quiet zone. The QR code standard requires a quiet zone of 4 modules around the symbol (JIS X 0510 — Japan’s national QR code standard, equivalent to ISO/IEC 18004 — section 5.3.8: “The quiet zone of a QR Code shall be 4X wide,” where X is the module width). A Data Matrix, by contrast, needs only 1 module on each side; the GS1 Data Matrix guideline makes a quiet zone one module wide on all four sides mandatory (section 1.1 of that guideline). With the quiet zone added, the QR code becomes 21 + 4×2 = 29 modules and the Data Matrix 16 + 1×2 = 18 modules. That is about 0.62 times per side, and a little under 40% of the area.
I compared a few other examples the same way. The QR codes use error correction M, and the Data Matrix codes were made with the tool’s “Square” and “Rectangle” shapes.
| Input string | QR code (with quiet zone) | Data Matrix square (with quiet zone) | Data Matrix rectangle (with quiet zone) |
|---|---|---|---|
TL-0001 (7 characters) |
21×21 (29×29) | 14×14 (16×16) | 32×8 (34×10) |
TL-2026-0153 (12 characters) |
21×21 (29×29) | 16×16 (18×18) | 32×8 (34×10) |
PN:RC0603-10K LOT:2611 (22 characters) |
25×25 (33×33) | 20×20 (22×22) | 36×12 (38×14) |
https://www.ixam.net/ (21 characters) |
25×25 (33×33) | 20×20 (22×22) | 36×12 (38×14) |
A QR code spends a lot of modules on the three large squares in its corners (finder patterns) and the separators around them. A Data Matrix shows its orientation and size with a solid black line along the left and bottom edges and an alternating black-and-white line along the top and right edges, so short data fits in a small symbol.
Keep in mind that this compares only module counts; it doesn’t mean the two are equally easy to read. The smallest readable module size depends on how you print and what you scan with. Also, while a QR code lets you choose an error correction level of L, M, Q or H, Data Matrix uses a fixed error correction scheme, ECC 200, with no strength setting (GS1 guideline, section 1.2.4). How well a code survives dirt and scratches is something to confirm by printing a test label and scanning it where it will be used.
Creating a Data Matrix from an asset number
Now for the tool itself, step by step. The screenshots show the English version of the page.
1. Enter the number and choose a shape
When you open the tool, the “Text or URL to encode in the Data Matrix” field already contains https://www.ixam.net/, and the preview on the right shows its Data Matrix. Clear the field and type the asset number TL-2026-0153. The preview redraws automatically whenever you change the input or settings.
Leave “Shape” at “Square (automatic size)”. The tool picks the symbol size to match what you entered, so you don’t need to specify a module count yourself.
The line under the preview, “16 × 16 modules / 160 × 160 px / 12 bytes (UTF-8)”, describes the Data Matrix that was created. The 160 pixels come from 16 modules plus the default quiet zone of 2 modules on each side (20 modules), times 8 pixels per module.
2. Adjust module size, quiet zone and colors
There are four settings:
- Module size (px): how many pixels each module is drawn with, from 1 to 40. This determines the size of the PNG you save.
- Quiet zone (modules): 1 to 20 modules. The default of 2 is one module more than the standard’s minimum of 1. Set it to 1 only when your label really has no room to spare.
- Foreground color / Background color: the colors of the code and its background, black on white by default. Scanners read the contrast between light and dark, so keep the background light and the foreground clearly dark. Choosing the same color for both produces an error.
3. Save as PNG or SVG
“Save as PNG” saves datamatrix.png, and “Save as SVG” saves datamatrix.svg. PNG is fine if you only paste it into label software or a document for on-screen use. For printing, SVG is easier to work with, because module edges stay sharp however you scale it.
The print size is “module count × module size”
When printing on a label, first decide how many millimeters one module should be, then calculate the overall size from that.
Side length including quiet zone = (module count + quiet zone modules × 2) × module size
If you saved the square TL-2026-0153 (16×16 modules) with the default 2-module quiet zone, it is 20 modules including the quiet zone. At 0.3 mm per module that is 6.0 mm; at 0.5 mm it is 10.0 mm. With a 1-module quiet zone it is 18 modules, giving 5.4 mm and 9.0 mm respectively.
The SVG this tool exports uses the module count including the quiet zone directly as its coordinate units (viewBox="0 0 20 20" for 20 modules). After placing it in Word, label software, Illustrator or similar, lock the aspect ratio and set the width to the value you calculated. If you use a PNG, choose a fairly large module size in pixels and scale it down to the same dimensions after placing it.
How small a module can go depends on the printer’s resolution, the label material and the device used for scanning. The safe approach is to print one label at the chosen size, scan it several times with the actual scanner or smartphone you will use, and only then print the whole batch. The way to think about QR code print sizes is covered in detail in “How to make a QR code for flyers and business cards”. The order — find the module count first, then decide the dimensions — is the same for Data Matrix.
Use a rectangle for long, narrow spaces
When there is little vertical room — a label wrapped around a cable sheath, the barrel of a pen-shaped tool, a thin strip on the front of a drawer — set “Shape” to “Rectangle (automatic size)”. The GS1 guideline describes rectangular Data Matrix as suited to high-speed printing processes and special print areas (section 1.2.1).
TL-2026-0153 becomes 32×8 modules, or 34×10 modules with a 1-module quiet zone. At 0.3 mm per module it fits in a strip about 10 mm wide and 3 mm tall.
A rectangle holds less than a square. The standard defines six rectangular sizes, 8 to 16 modules tall and 18 to 48 modules wide, holding at most 96 digits or 71 alphanumeric characters (GS1 guideline, section 1.2.2). The largest amounts I actually fit with this tool were 94 digits, 69 uppercase letters, or 15 kanji (Chinese characters as used in Japanese), all in the largest 48×16 size. They fall slightly short of the standard’s maximum because the tool puts an indicator of the character encoding (the ECI, explained below) at the start of the data.
If the data doesn’t fit, the preview disappears and the message “The data does not fit in a rectangular Data Matrix. Shorten the data or choose Square.” appears. If you need a rectangle, shortening your numbering scheme is the realistic fix. Square symbols go up to 144×144 modules, and I fit up to 3,112 digits, 2,332 uppercase letters, or 518 kanji.
Non-ASCII text works, but use alphanumeric IDs on labels
The input field accepts non-ASCII text such as Japanese, Chinese or accented letters, as well as emoji and line breaks. The tool stores the text as UTF-8 and adds ECI 26 at the start, which tells the scanner “this content is UTF-8”. For example, 工具 TL-0153 (工具 means “tool” in Japanese; 14 bytes) became 18×18 modules, and the Data Matrix Reader showed it as 工具 TL-0153, exactly as entered.
Not every scanner or app supports ECI, though. The tool’s notes also say that to read Japanese text, emoji and other non-ASCII characters correctly you should use a reader that supports the UTF-8 ECI. On devices that don’t, those characters may not display correctly. On top of that, a kanji takes 3 bytes in UTF-8 (accented Latin letters and Cyrillic take 2), so the same number of characters needs more modules, and a rectangle holds only 15 kanji.
For managing tools and parts, it is easier to put only an alphanumeric asset number like TL-2026-0153 in the code and keep the item name, storage location and borrower in the register. The code stays small, works with any scanner, and you don’t have to reprint the label when an item name changes.
Scan the code you made to check it
Before printing, scan the saved image once. In the Data Matrix Reader, choose the saved PNG under “Image file”, and reading starts immediately, with the result shown in “Decoded text”. On a computer you can also paste a copied image into the page.
All three codes made in this article — the square and rectangular TL-2026-0153 and 工具 TL-0153 with Japanese text — decoded exactly as entered. The reader decodes with a different library (zxing-wasm) from the generator, so the chance that both generation and reading share the same mistake is small.
An image that decodes on screen won’t necessarily scan once printed. Check printed labels by holding them up to a smartphone or PC camera with the reader’s “Start camera” button, or with the scanner you use on site. Reading barcodes with a camera is also covered in “Read barcodes with a phone or PC camera for stocktaking and delivery checks”.
Making dozens of codes, or encoding product codes
If you are printing dozens of asset-number labels at once for a tool inventory, it is faster to put the list of numbers in a CSV and use Batch-generate Data Matrix codes from CSV and print to PDF than to save and arrange codes one by one. It creates Data Matrix codes from the column you choose and lays them out in an A4 PDF with captions such as item names. Things to watch for when handling CSV files from Excel are covered, using JAN barcodes as the example, in “Bulk-create JAN barcodes from an Excel product list and print them on A4” (article in Japanese; JAN is the name used in Japan for EAN-13 product barcodes).
On the other hand, if you need to encode a product code (GTIN), lot number or expiry date according to GS1 rules — as with pharmaceuticals and medical devices — use the GS1 DataMatrix Generator rather than this tool. It looks like the same Data Matrix, but the GS1 format puts a special character (FNC1) at the start and has fixed rules for separating the data. Typing something like ^FNC1 into this tool just stores it as an ordinary string.
If your scanning setup can’t read Data Matrix, the Micro QR Code Generator, which also prints small, is another option. Its quiet zone is 2 modules (JIS X 0510, 5.3.8). Standard smartphone cameras may not read it, though, so again, test on the reading side before deciding. The tools for creating and reading 2D codes are gathered in the 2D Code Workspace.