Hardware
What the Barcode and QR Code on a Receipt Actually Do
Code 128 encodes the transaction ID the returns desk scans. The QR points at an e-receipt, survey or warranty. Here are the print specs that decide whether either one scans.
· 9 min read
The bars at the bottom of a receipt hold one thing: the transaction identifier. Not the prices, not the items, not the card. The QR next to them holds a URL. Everything else people assume is in there — the basket, the loyalty profile, the payment details — lives in the point of sale, and the printed symbols are just the fastest way to ask for it.
Code 128 and what a transaction ID is made of
Code 128 is the default because it is dense, it is self-checking, and it encodes the full printable ASCII set across three subsets. Subset B covers the letters, digits and punctuation a formatted identifier needs. Subset C encodes digits two at a time in a single symbol character, which roughly halves the width of a numeric payload. A well-designed transaction identifier is built so that subset C can be used.
A retail transaction identifier is almost always a composite of four parts, concatenated in a fixed order so it sorts chronologically and is unique without a central sequence:
0142-03-20260805-004417
^^^^ ^^ ^^^^^^^^ ^^^^^^
| | | |
| | | +-- sequence no. for the day
| | +--------- business date 05 Aug 2026
| +--------------- register or lane 03
+------------------- store or site 0142The sequence restarts each business day per register, so this is the 4,417th sale rung on lane 03 that day. Nothing in the string is a global counter, which is why the store, register and date components have to be there — together they are what makes the sequence unique.
The business date matters more than it looks. It is not the calendar date — it is the trading day the register was open under, which for a bar or a late-night kitchen runs past midnight. A sale rung at 01:40 on the sixth belongs to the fifth, and if the identifier used the calendar date the day would not reconcile.
Width is a real constraint here. A Code 128 symbol is 11 modules per symbol character plus 35 modules for the start, check and stop characters. That 23-character string encoded in subset B is 23 data characters, so 11 times 23 plus 35 is 288 modules. At the usual 0.25 mm X-dimension that is exactly 72 mm — the entire printable width of an 80 mm roll, with nothing left for a quiet zone. Strip the hyphens and encode the 20 remaining digits in subset C and you get 10 symbol characters, so 11 times 10 plus 35 is 145 modules, or 36.25 mm. That version fits on a 58 mm tape with room to spare. The hyphens belong in the human-readable line, not in the bars.
How the returns desk uses it
The scan is a lookup, not a decode. The clerk scans, the point of sale pulls the stored transaction from its journal, and the whole basket comes back exactly as it was rung: every line, every unit price, every discount, the tax that was charged on each taxable line, the tender that settled it. That last part is what makes the barcode worth printing — the refund has to go back to the tender it came from, and only the journal knows what that was.
It also decides what can be returned. A partial return needs the system to know which of the three identical items has already been brought back, and a return-policy window needs the business date the barcode carries. When the scan fails, the clerk keys the digits printed underneath and lands in the same place. That fallback is why the human-readable interpretation text is not optional in any real deployment, however good the printer is.
The other symbologies you meet
| Symbology | Where it shows up | What it carries |
|---|---|---|
| Code 128 | Foot of retail, hardware and grocery tape | Transaction identifier |
| UPC-A | Price labels, return and re-scan slips | GTIN-12 of one product |
| Interleaved 2 of 5, Code 39 | Legacy registers, parking tickets | Transaction or ticket number |
| PDF417 | Rebate and returns slips | The full basket, for offline validation |
| QR | Foot of tape, customer copy | A URL |
| Aztec | Transit and parking gate tickets | A gate or exit token |
UPC-A is worth knowing precisely because its dimensions are fixed by GS1 rather than chosen by you. At 100 percent magnification the symbol is 37.29 mm by 25.91 mm with a 0.33 mm X-dimension, and the permitted magnification range is 80 to 200 percent. On a 203 dpi head one dot is 0.125 mm, so the nearest X-dimension you can actually render is either two dots at 0.25 mm — which is 75.8 percent magnification and therefore out of spec — or three dots at 0.375 mm, which is 113.6 percent and legal, and which widens the symbol to about 42 mm. On an 80 mm tape that is fine. On 58 mm it is nearly the whole printable band.
PDF417 carries the basket instead of a key to it, which is exactly what a rebate processor or an offline returns terminal needs. It is also wide. A stacked symbol with enough columns to hold a twenty-line basket does not fit comfortably on 58 mm, which is why you see it on document-format slips rather than narrow tape.
Aztec turns up where the ticket is card-sized rather than tape — transit gates, parking exits. It needs no quiet zone at all, which is its whole advantage when a printed area is 54 by 86 mm and every millimetre is spoken for.
What receipt QR codes actually point to
- An e-receipt permalink — the same document, hosted, so the customer has a copy that will not fade.
- A survey pre-seeded with the store, date and transaction number, so the response is attributable without asking the customer to type anything.
- Warranty registration, which is the one customers actually use, because the proof of purchase and the registration form arrive together.
- A returns portal for starting a return before travelling to the counter.
- Loyalty enrolment, usually deep-linked so the just-completed sale can be credited retroactively.
- A tip or pay link on formats where the tape is printed before payment is settled.
Why a 58 mm QR has to be a short link
QR symbols come in versions. Version 1 is 21 by 21 modules and each version up adds four modules per side, so version 2 is 25 by 25 and version 10 is 57 by 57. Capacity climbs with version: at error correction level M in byte mode, version 2 holds 26 bytes and version 10 holds 213. Your URL length picks the version, and the version picks the physical size.
Now apply the head. At 203 dpi the minimum sane module is three dots, or 0.375 mm. A 26-character short link fits version 2, so 25 modules times three dots is 75 dots, plus a four-module quiet zone on each side at 24 dots, for 99 dots — about 12.4 mm square. Comfortable on a 384-dot tape. A 200-character URL with campaign parameters forces version 10: 57 modules times three dots is 171 dots, plus quiet zones, is 195 dots, or 24.4 mm. That is half the printable width of a 58 mm roll with every module sitting at the absolute floor the head can resolve. Raise the module to four dots for reliability and the same code needs 260 dots, or 32.5 mm, and you are down to a 15 mm margin on a tape that also has to carry text.
The fix is not a smaller module. It is a shorter payload. Redirect through your own short domain and put the campaign parameters on the server side of the hop.
The print specs that decide whether it scans
- X-dimension of at least 0.25 mm for a 1D symbol. At 203 dpi that is two dots exactly, which is why it is the conventional floor rather than a rounder number.
- Bar height of 10 to 15 mm. Shorter symbols force the scanner into a narrower vertical window and fail on a slightly angled swipe. Height costs you tape length, which is the cheapest thing on the receipt.
- Quiet zones. Code 128 wants ten times the X-dimension of blank space on each side, so 2.5 mm at the 0.25 mm floor. QR wants four modules, which is 1.5 mm at a three-dot module. A symbol butted against a dashed rule is a symbol that does not scan.
- Error correction level M for QR on receipts. Level L is fragile once the thermal image starts to fade, and levels Q and H push the version up for no benefit on paper that is read within days.
- Integer dot multiples. Every module and every bar has to be a whole number of dots. A module of 2.6 dots gets rounded inconsistently across the symbol, and the result is a code whose modules are alternately two and three dots wide.
- Never letterbox the image. Scaling a rendered barcode to fit a layout box changes the X-dimension to something the head cannot hit and destroys the ratio between wide and narrow elements. Generate the symbol at the size it will print.
- Always print the human-readable text. Under a 1D symbol it is the fallback when the scan fails. Under a QR it is what lets a cautious customer see where the link goes before they open it.
What you must not encode
A barcode is printing. Every rule that governs what may appear as text on a receipt governs what may be encoded in the symbol next to it. FACTA, at 15 U.S.C. section 1681c(g), bars a cardholder receipt from showing more than the last five digits of the card number and bars the expiration date entirely — and a scanner reading a 16-digit PAN out of a Code 128 symbol is exactly the disclosure the statute exists to prevent.
Beyond card data, keep customer names, email addresses, phone numbers, loyalty identifiers and any account number out of the payload. A receipt is a document that gets dropped in car parks and photographed for expense reports. Encode an opaque reference, put the personal data behind an authenticated lookup, and the printed symbol tells a stranger nothing they can use.
The same reasoning applies to the QR destination. A permalink that renders a full receipt with a customer name to anyone holding the URL is a slower version of the same mistake. Either make the hosted copy require a login, or keep personal detail off it.
Adding one to your own receipts
Start with the identifier, not the symbol. Decide your store or site number, your register or channel number, and a per-day sequence, and format them so the numeric core can be encoded in subset C. Six leading zeros in the sequence are cheaper than a re-numbering exercise in eighteen months.
Then decide what the code is for. If it exists so you can find the sale again, a 1D symbol of the identifier is the whole job. If it exists so the customer can do something — keep a copy, register a warranty, start a return — you want a QR pointing at a short link, and the 1D symbol is optional. Printing both is normal on 80 mm and cramped on 58 mm.
The formats in the template gallery that carry a code place it below the totals and the footer with the quiet zone already allowed for, and print the identifier as text underneath, because a symbol that cannot be read by eye is a symbol with a single point of failure.
Common questions
What does the barcode on a receipt mean?
It encodes the transaction identifier and nothing else. On most retail tape that identifier is a composite of the store or site number, the register or lane number, the business date and a sequence number for that register that day. There is no price, no product list and no card data in it. The human-readable digits printed under the bars are the same string.
How does a store use the receipt barcode for returns?
The barcode is a lookup key, not the basket itself. Scanning it pulls the stored transaction from the point-of-sale journal so the clerk gets the exact lines, prices and tax as they were rung, without keying a 20-digit number by hand. If the scan fails the clerk types the printed digits and gets the identical result, which is why the human-readable text underneath is mandatory in practice.
Is the barcode on a receipt Code 128?
Usually. Subset B handles the mixed letters, digits and hyphens of a formatted transaction ID; subset C encodes digits in pairs and roughly halves the symbol width when the payload is purely numeric. Older electronic cash registers and some parking equipment still emit Interleaved 2 of 5 or Code 39, and rebate and returns slips sometimes carry PDF417 because it holds the whole basket rather than a key to it.
What is the QR code on a receipt for?
One of about six things: a permalink to the electronic copy of the receipt, a survey URL pre-seeded with the store, date and transaction number, a warranty registration form, a returns portal, a loyalty enrolment link, or a tip or pay link. It is a destination, not data. If a QR encodes the transaction itself it is so a handheld can validate the receipt with no network, which is rare outside logistics.
How do I add a QR code to my own receipts?
Encode a short link, keep the module at three print dots or more, leave a four-module quiet zone, use error correction level M, and print the destination as text underneath. On a 58 mm tape a 200-character URL forces the symbol up to a 57 by 57 module version that eats about half the printable width; a 25-character short link fits in a 25 by 25 version at under 13 mm square.
What should you never encode in a receipt barcode?
Never a card number, never an expiry date, and never a customer name, email, phone number or loyalty identifier in plain text. FACTA already bars printing more than the last five digits of a card or the expiry on a cardholder receipt, and a barcode is printing. Encode an opaque reference and keep the personal data behind an authenticated lookup.
References
- 1.GS1 General Specifications — X-dimension, magnification and quiet zones — GS1. Accessed August 2026.
- 2.Barcodes — the GS1 symbology family — GS1. Accessed August 2026.
- 3.ISO/IEC 18004:2015 — Automatic identification and data capture techniques: QR Code bar code symbology specification — ISO. Accessed August 2026.
- 4.ESC/POS Command Reference — barcode and 2D symbol commands — Seiko Epson Corporation. Accessed August 2026.
- 5.What Are QR Codes on Receipts and Why Use Them — QRStuff. Accessed August 2026.
- 6.QR Codes on Receipts — QRCodeKit. Accessed August 2026.
- 7.15 U.S.C. §1681c(g) — Truncation of credit card and debit card numbers — Cornell Law School, Legal Information Institute. Accessed August 2026.