How to Encode RFID Tags: UHF, HF and NFC Compared
Encoding an RFID chip isn't just pushing…
Encoding an RFID chip isn't just pushing data at it. You have to target the right memory bank first — and UHF, HF and NFC each use a different command with a different parameter structure.
The full sequence: the label feeds in, EPC is written inside the coupling zone, then content prints
The four memory banks on a UHF tag
UHF tags (ISO18000-6C) manage memory in banks, and every write must name one.
| Code | Bank | Full name | Contents | First block |
|---|---|---|---|---|
R | Reserved | Reserved | Kill password (blocks 0–1), access password (blocks 2–3) | 0 |
E | EPC | Electronic Product Code | EPC data, CRC, PC bits | 2 |
T | TID | Tag identifier | Factory-programmed unique ID, read-only | 0 |
U | USER | User memory | Your own data | 0 |
Two things trip people up constantly.
First, the EPC bank starts at block 2, not 0. Blocks 0 and 1 hold the CRC and protocol control bits, which the chip maintains itself. User-written EPC data begins at block 2.
Second, the USER bank starts at block 0. Same idea — user memory — completely different address. Mix them up and the write silently fails.
The TID bank is read-only. Any write attempt returns an error. To read a chip's factory serial, use UHFR against bank T.
Writing EPC data: the four UHFW parameters
UHFW a, b, c, d, "data"
| Param | Meaning | Default | Options |
|---|---|---|---|
a | Access mode | H | A or H |
b | Start block | 2 | Depends on bank |
c | Byte count | 12 | Actual data length |
d | Bank code | E | R / E / T / U |
Writing a 96-bit EPC (12 bytes, i.e. 24 hex characters):
UHFW H, 2, 12, E, "11223344556677889900AABB"
12 is the byte count and corresponds to 24 hex characters. The count and the string length must agree. Specify 12 but supply 20 characters and the write is either truncated or rejected.
Writing to USER memory (start block 0, bank U):
UHFW H, 0, 8, U, "A1B2C3D4E5F60718"
Want confirmation? Use UHFWB
Plain UHFW writes and says nothing. To confirm success you'd have to send a separate UHFR read.
UHFWB folds both into one — it writes and returns the EPC to the host immediately.
UHFWB H, 2, 12, E, "11223344556677889900AABB"
On a production line, prefer UHFWB. The host gets the result without a second command, and you avoid the classic timing bug where the read returns the previous label's data.
Reading tags: UHFR versus UHFQ
UHFR a, b, c, d
Same four parameters, same order: bank, start block, byte count, bank code.
UHFR H, 2, 12, E
Reads 12 bytes from the EPC bank.
If the tag has a read-only EPC (locked at manufacture), UHFR may return nothing. Use UHFQ instead:
UHFQ H, 0, 0
UHFQ exists purely to fetch the EPC identifier. The last two parameters are reserved — pass 0. This is also the fastest way to test whether a chip responds at all, since it performs no write.
HF tags: how HFW works
HF covers two families, ISO14443A and ISO15693. Both use HFW.
HFW f, n, s, [l], "data"
| Param | Meaning | Values |
|---|---|---|
f | Tag type | A (ISO14443A) or F (ISO15693) |
n | Start block | Per tag specification |
s | Byte count | Actual data length |
l | Lock flag | Optional; L locks after writing |
ISO14443A example:
HFW A, 0, 47, "|PN7K33DF50501|LT02681730310A1|LS02681730310A1|"
ISO15693 example:
HFW F, 0, 20, "PEASY-MARK-2026-0001"
Treat L with care on ISO15693. Adding it locks the chip permanently after writing, and there is no unlock command. That's a protocol limitation, not a printer limitation.
Read back to verify:
HFR A, 0, 47
Read the HF chip's factory UID:
HFQ A, 0, 0
The UID is burned in at manufacture, globally unique and immutable. For asset tracking and anti-counterfeiting, use the UID as the primary key rather than a business number you wrote yourself — business numbers can collide, UIDs cannot.
NFC tags: how NFCW works
An NFC tag is technically an HF tag, but its data follows NDEF — the NFC Forum standard format that phones understand natively.
NFCW [l], "data"
l is an optional lock flag; data is the payload. NDEF imposes format rules, so arbitrary strings won't work:
| Purpose | Format | Example |
|---|---|---|
| Open a web page | Starts with https:// | NFCW "https://www.peasymark.com" |
| Place a call | Starts with tel: | NFCW "tel:+8612345678900" |
A complete job that taps through to a contact page:
SIZE 50 mm, 30 mm
GAP 2 mm
CLS
NFCW "https://www.peasymark.com/en/contact/"
TEXT 10,10,"TSS24.BF2",0,1,1,"Tap to contact us"
PRINT 1
Tap the finished label with a phone. If the browser opens, it worked.
If the phone does nothing, check the format first. Writing www.peasymark.com without the scheme is the single most common cause — phones don't recognise it as a URL.
Side-by-side comparison
| UHF (UHFW) | HF (HFW) | NFC (NFCW) | |
|---|---|---|---|
| Tag type | ISO18000-6C | ISO14443A / ISO15693 | NDEF (over HF) |
| Read range | Long (metres) | Short (centimetres) | Tap-to-read |
| Bank selection | Required (R/E/T/U) | Not required, block only | Not required, NDEF format |
| Lock reversible | Yes (UHFG2) | ISO14443A yes, ISO15693 no | Not recommended |
| Phone readable | Mostly no | Yes | Native |
| Typical use | Warehousing, production, assets | Access control, anti-counterfeit, tooling | Marketing, traceability |
The selection logic is simple: need a phone to read it? NFC. Need long-range bulk reading? UHF. Neither? HF.
Frequently asked questions
The write succeeded but reading returns nothing
Check the bank code. Writing to U and reading from E returns empty every time.
Then check the byte count. Write 12 bytes, read 8, and the tail is invisible. Read 16 and the extra comes back as padding that looks like corruption.
The EPC length comes out wrong
EPC length must be a whole number of bytes, and in practice should be 12 bytes (96 bits) or a multiple of it. A 10-byte EPC works on some readers and is rejected by others.
Design around 12 bytes / 24 hex characters. It's the most compatible choice.
Can a locked ISO15693 tag be recovered?
No. Once HFW F, ..., L executes, the tag is permanently read-only. No command reverses it.
This is why L belongs at the final delivery step only. Lock during production and you scrap the batch.
Can one tag hold both UHF and HF data?
No. UHF and HF are separate chips on separate antennas operating at different frequencies. Dual-frequency tags exist but need dedicated equipment to program each side.
To read both, use two labels or a genuine dual-frequency inlay.
What's the difference between UID and EPC?
The UID is burned into the chip at manufacture, lives in the TID bank and can never change.
The EPC is written by you and can be rewritten indefinitely.
For asset tracking, key on the UID and store business data in the EPC.
Need a hand?
Tell us your tag model and what the data is for, and we'll help you get the command right.
Related guides
Need help choosing a printer?
Tell us your label size, print volume and environment — we will recommend the right model and settings.
Request a Quote