Rectangular Data Matrix generator

For narrow labels, tubes and edges. Pick a standard rectangle or an extended DMRE size, and see exactly what fits.

Rectangle sizes

8 × 18 to 16 × 48, the original sizes (ISO/IEC 16022). Almost every 2D scanner reads them.

Part numbers, serials, links or any text. Spaces, leading zeros and line breaks are kept exactly. The preview shows an example until you type.

Example

8 × 32 squares (modules)

Each small square is one module. The white frame is the blank border (quiet zone): 2 squares wide. Keep it clear when you place the code.

Need a square code? Use the square generator

8 × 32 modules · 90% full16 mm × 4 mm · 18 mm wide with the blank border

GS1 data (GTIN, expiry, lot)? Use the GS1 generator

An image for documents, web pages and most label software.

Make a batch

Size, print size, colors and captionAutomatic size · 0.5 mm squares
Shape and size

Automatic picked 8 × 32, the smallest size that fits.

Print size
Set the size by
millimeters

Code 16 mm × 4 mm, or 18 mm × 6 mm with the blank border.

No rounding. Laser and inkjet printers print the exact size.

Text under the code

Printed under the code, outside its blank border. It is not part of the encoded data.

Advanced: blank border, colors, encoding
Blank border (quiet zone)

Scanners need clear space around the code. The standard minimum is 1 square; we use 2 by default. Never less than 1.

Colors

Contrast 21 : 1. Dark squares on a light background scan best.

Character encoding

Plain letters, digits and symbols are stored exactly as typed. Accented letters such as é use Latin-1, the standard default. Anything else (€, emoji, Chinese) uses UTF-8 with a marker (ECI) that tells the scanner.

What the rectangular generator does

  • All 24 rectangle sizes

    6 standard sizes plus 18 DMRE sizes, or let Automatic pick.

  • Standard by default

    The sizes almost every scanner reads. DMRE only when you switch it on.

  • Exact print size

    Set the square size or the code width. True-size PDF, SVG and PNG.

  • Checked after every change

    An independent decoder reads each code back before it says so.

How it works

How to make a rectangular Data Matrix

Everything happens in your browser. What you type is never uploaded.

  1. Step 1: Choose Standard or DMRE

    Standard gives the 6 original rectangles. DMRE adds 18 newer sizes for long, low strips and more data. Not sure? Stay on Standard.

  2. Step 2: Type your text

    A part number, lot or serial. Automatic picks the smallest rectangle that fits, or choose a fixed size under the code.

  3. Step 3: Set the print size and download

    Pick the size of each small square or the code width, then download PNG, SVG or a true-size PDF. Print at 100% / Actual size.

Square, rectangle or DMRE

Same data, three shapes

A rectangle trades width for height. For PART-000123 LOT 2611 the square code is 9 mm tall with 0.5 mm squares. The standard rectangle is 6 mm tall, and the lowest DMRE size that holds it, 8 × 48, is only 4 mm tall but 24 mm wide.

  • Square

    18 × 18 modules

    9 mm tall, 9 mm wide

  • Standard rectangle

    12 × 26 modules

    6 mm tall, 13 mm wide

  • DMRE rectangle

    8 × 48 modules

    4 mm tall, 24 mm wide

The same text, PART-000123 LOT 2611, made three ways with the same 0.5 mm squares. Sizes are for the code itself; add the blank border (2 squares on each side here) when you plan the label.

Rectangles hold less than a square of the same area, because more of each code is border. Pick a rectangle when height is what you are short of, not to save space overall.

When to use it

When to choose a rectangle

Use a rectangle when the space is narrow. Everywhere else, a square code is the safer choice.

  • Narrow labels

    Shelf edges, bin labels and small product labels where a square would have to shrink too far.

  • Cables and wires

    Wrap-around and flag cable markers, where the code has to fit a thin band.

  • Test tubes and vials

    Run the long side along the tube, so the short side bends around the curve.

  • Edges of circuit boards and parts

    The border of a PCB or the side of a part, marked by laser or label.

Choose a square when you can. Square codes are the most widely supported, hold more data for their area, and are what GS1 prefers. The square Data Matrix generator makes them.

Keep the blank border. A rectangle needs the same clear margin as a square, at least 1 square wide on every side (the generator adds 2). On a narrow label, plan the height with the border included. More in quiet zone and print size.

Never stretch it to fit. Each small square must stay square. To fill a space, choose a different rectangle size or a different square size in the options, never scale one direction in your label software.

Sizes and capacity

Rectangular Data Matrix sizes and capacity

Rows × columns of small squares (modules). Capacity is the most of one kind of character; mixed text holds a little less.

The 6 standard rectangles (ISO/IEC 16022)

Size Digits Capitals Bytes Printed, W × H
8 × 18 10 6 3 9 × 4 mm
8 × 32 20 13 8 16 × 4 mm
12 × 26 32 22 14 13 × 6 mm
12 × 36 44 31 20 18 × 6 mm
16 × 36 64 46 30 18 × 8 mm
16 × 48 98 72 47 24 × 8 mm

The 18 DMRE rectangles (ISO/IEC 21471)

Grouped by height: 8, 12, 16, 20, 22, 24, 26 squares tall. Check that your scanners read DMRE before you use these.

Size Digits Capitals Bytes Printed, W × H
8 × 48 36 25 16 24 × 4 mm
8 × 64 48 34 22 32 × 4 mm
8 × 80 64 46 30 40 × 4 mm
8 × 96 76 55 36 48 × 4 mm
8 × 120 98 72 47 60 × 4 mm
8 × 144 126 93 61 72 × 4 mm
12 × 64 86 63 41 32 × 6 mm
12 × 88 128 94 62 44 × 6 mm
16 × 64 124 91 60 32 × 8 mm
20 × 36 88 64 42 18 × 10 mm
20 × 44 112 82 54 22 × 10 mm
20 × 64 168 124 82 32 × 10 mm
22 × 48 144 106 70 24 × 11 mm
24 × 48 160 118 78 24 × 12 mm
24 × 64 216 160 106 32 × 12 mm
26 × 40 140 103 68 20 × 13 mm
26 × 48 180 133 88 24 × 13 mm
26 × 64 236 175 116 32 × 13 mm

Printed sizes are for the code alone; add the blank border on every side. Capitals means capital letters, digits and space; lower-case letters, digits and space fit the same number. Bytes is what fits whatever the data, such as mixed-case text, punctuation or accented letters (an accented letter usually takes 2 bytes). Square sizes are in all Data Matrix sizes.

DMRE

DMRE: the extended rectangles

DMRE (Data Matrix Rectangular Extension) is ISO/IEC 21471, first published in 2020. It adds 18 rectangles to the 6 in the original standard. The codes are built the same way, with the same error correction, so nothing changes about how you print them. What changes is the choice of shapes:

  • Lower strips. Rectangles only 8 squares tall now run up to 144 squares long. A 8 × 144 code holds 126 digits in a band 4 mm high with 0.5 mm squares.
  • More data in a rectangle. The largest, 26 × 64, holds 236 digits, more than twice the 98 of the largest standard rectangle.
  • More steps in between, so Automatic can find a closer fit.

Will my scanner read DMRE?

Maybe not. DMRE is newer than the rest of Data Matrix, and a scanner, phone app or verifier reads it only if its decoder supports ISO/IEC 21471. Newer 2D imagers often do; older ones may need a firmware update, and some cannot read it at all. A scanner that does not support DMRE usually returns nothing, as if there were no code.

Test before you print many

Print one DMRE code from this page at your real size and scan it with every scanner and app that will see your labels. If any of them fails, switch the generator back to Standard. The scanner test sheet includes a DMRE code for this check.

This generator checks each code with zxing-cpp, an open-source decoder that reads DMRE. “Data decoded successfully” tells you the code is built correctly; it cannot tell you whether your own scanner supports DMRE. To read a DMRE code in your browser, from a photo or your camera, use our reader.

When Automatic and DMRE meet. With DMRE switched on, Automatic picks the smallest size from all 24 rectangles. That can be a DMRE size even when a standard one would fit. The generator says so under the code and offers the standard size instead.

Rectangular Data Matrix FAQ

What sizes can a rectangular Data Matrix be?

ECC 200 has 6 rectangular sizes: 8 × 18, 8 × 32, 12 × 26, 12 × 36, 16 × 36, 16 × 48 (rows × columns of small squares). The DMRE extension (ISO/IEC 21471) adds 18 more, from 8 × 48 up to 26 × 64, including the long 8 × 144 strip. See all Data Matrix sizes.

How much data fits in a rectangular Data Matrix?

The largest standard rectangle, 16 × 48, holds up to 98 digits, 72 capital letters and digits, or 47 bytes. The largest DMRE size, 26 × 64, holds 236 digits, 175 capitals or 116 bytes. A square code holds more if you have room for it.

What is DMRE?

DMRE stands for Data Matrix Rectangular Extension. It is a standard, ISO/IEC 21471, that adds 18 rectangular sizes to Data Matrix ECC 200. The codes work the same way, but the new sizes give more choice: lower strips (as low as 8 squares) and more data in a rectangle. Because it is newer, some scanners cannot read it yet.

Can every scanner read a rectangular Data Matrix?

The 6 standard rectangles have been part of ECC 200 from the start, so 2D scanners that read Data Matrix generally read them too. DMRE sizes need a scanner or app whose decoder supports ISO/IEC 21471, and some older ones do not. Print one DMRE code and scan it with every scanner that will see your labels before you print many. The scanner test sheet includes a DMRE code for exactly this.

Is a rectangular Data Matrix allowed for GS1?

GS1 DataMatrix is ECC 200, and GS1’s DataMatrix guideline allows rectangular symbols where space is tight, though it prefers square ones. Whether DMRE sizes are accepted depends on the current GS1 General Specifications for your sector and on your trading partners, so check before you use them for GS1 data. This page makes plain Data Matrix codes; for GS1 fields use the GS1 DataMatrix generator.

Should I use Automatic or a fixed size?

Automatic picks the smallest rectangle that holds your text, so it is right for one code. If many labels must look the same, or a label has a fixed space, choose a fixed size under the code. If your text does not fit that size, the generator says which size it needs. It never shortens your data.