Both are 2D matrix codes; the split is practical: Data Matrix owns tiny industrial marking; QR owns anything a consumer scans with a phone. Here is why each side of that line holds.
For short payloads, Data Matrix is meaningfully more compact — its smallest symbol is 10×10 modules versus QR's 21×21, and it can be laser-etched legibly at sizes down to ~2.5 mm square. That is why it dominates direct part marking: circuit boards, surgical instruments, aerospace components, and the GS1 Data Matrix on pharmaceutical packs (GTIN + batch + expiry + serial in a fingernail of space).
Every smartphone camera app decodes QR natively — point and tap. Data Matrix usually needs a dedicated scanning app. The moment the scanner is a member of the public, QR is the only defensible choice, which is why marketing, menus, payments, ticketing and GS1 Digital Link standardized on it.
QR tops out higher (7,089 digits vs 3,116) though both exceed real-world needs. Error correction differs in kind: QR offers selectable levels (7–30%), Data Matrix ECC 200 has fixed built-in Reed–Solomon. Both tolerate the damage levels their industries expect; Data Matrix's finder pattern (an L-shaped solid border) was designed for low-contrast etched marks on metal.
Tiny item, industrial scanner, regulated supply chain → Data Matrix (pharma specifically mandates GS1 Data Matrix in many markets). Consumer phones anywhere in the journey → QR. Generate either in our Data Matrix and GS1 Data Matrix tools, or QR generator.