RFID

EPC encoder and decoder for RFID tags

Turn a barcode number and a serial number into the code (EPC) that belongs in an RFID tag, for one tag or a whole spreadsheet, or read a tag’s code back into its parts.

This page works out what goes on the chip and makes the printer file. An RFID printer or encoder writes it. A web page can’t write an RFID chip by itself.

What goes in the tag

The 12, 13 or 14 digits under the product’s barcode, last digit included. For example 614141123452.

Readers use this to tell single items from cases and pallets.

Serial numbers

Serial numbers must never repeat for the same product. We start from the number you give us and count up. Keep a note of the last one you used.

Paste the EPC the way your reader shows it. Spaces, lower case and 0x at the front are all fine.

Or try an example

Decoding shows what a code says. It can’t tell you whether a tag was written correctly: only a reader can.

Tag codes for a whole list

One row per product. Your list needs a column with the UPC, EAN or GTIN (or with the text to write). A column for how many tags to make, and one for the first serial number, are optional.

Excel, CSV or rows pasted from a spreadsheet. Your list is read here in your browser. It isn’t uploaded.

Put a link or some text on an NFC tag

For the small stickers and cards that a phone reads with a tap.

What to put on the tag

This browser can’t write NFC tags. Writing them from a web page works in Chrome on Android phones.

What works instead: copy what you typed and paste it into an NFC writer app on your phone. On iPhone, that is the way to write a tag. iPhones can still read the finished tag.

NFC and RFID are different things

NFC tap tags, the kind phones read, are a different technology from the RFID tags retailers ask for. One can’t stand in for the other.

NFC tagRFID tag (UHF, “RAIN”)
Read fromA touch: a few centimetersMeters away, many tags at once
Read byAlmost any modern phoneDedicated RFID readers. Phones can’t.
HoldsA web link or short textA tag code (EPC), such as SGTIN-96
Written byA phone, as on this tabAn RFID printer or encoder
Retail RFID programsNot what they ask forWhat they ask for

A tag written here opens the link when someone taps it with their phone. It doesn’t make a product “RFID tagged”.

Your GS1 Company Prefix

The first part of your UPC or EAN is a block of digits that GS1 licensed to your company. It is between 6 and 12 digits long. An RFID tag stores “your company” and “this product” in two separate compartments, so we need to know exactly where one ends and the other begins.

Where to find it

  • Look at the prefix certificate or welcome email from GS1, or log in to your GS1 account. It lists your “GS1 Company Prefix”.
  • If your paperwork says “U.P.C. Company Prefix”, add a 0 in front. That makes it one digit longer: U.P.C. Company Prefix 614141 (6 digits) is GS1 Company Prefix 0614141 (7 digits).
  • If you bought one barcode number at a time (a “single GTIN”), choose 12 digits. GS1’s rule is to encode those with 12.
  • If you still can’t find it, ask the GS1 office that issued your numbers. Please don’t guess.

Why we won’t guess for you

The same barcode and serial number give a completely different tag code for each possible length. A wrong choice still looks fine when you decode it, because it turns back into the right barcode number. But a retailer’s system compares the whole code and won’t recognize it as yours, and retail tags are often locked for good once they are written.

If your barcode numbers came from a reseller, the prefix belongs to another company. We can still work out a code, but a retailer may not accept it.

UPC to EPC (SGTIN-96) in three steps

Retail RFID tags carry an SGTIN-96: the product’s barcode number and a serial number, packed into 96 bits and written as 24 hexadecimal characters. Here is the whole way from a UPC to that code. The example was worked out by this page’s own encoder.

  1. Start from the UPC and your company prefix

    Take the UPC-A 614141123452 and put two zeros in front to make the 14-digit GTIN 00614141123452. Its GS1 Company Prefix is 0614141: 7 digits, the U.P.C. Company Prefix 614141 with a 0 in front.

  2. Split it into the parts the tag keeps

    The tag keeps the company prefix (0614141) and an item reference: the GTIN’s first digit followed by the rest of the product number (012345). The last digit, the check digit 2, is left out, because a reader can work it out again. To those it adds a filter value, here 1 for an item sold at the till, and a serial number, here 6789.

  3. Pack the parts into 96 bits

    Each part gets a fixed number of bits. The partition (5) says where the company prefix ends and the item reference begins. Written out in hexadecimal, the 96 bits are the tag code.

PartBitsSays
Header0011000030: an SGTIN-96
Filter0011: an item sold at the till
Partition1015: a 7-digit company prefix
Company prefix0000100101011110111111010614141
Item reference00000011000000111001012345
Serial number000000000000000000000000011010100001016789

The tag code (EPC): 3034257BF40C0E4000001A85

Its tag URI, the same thing written for people: urn:epc:tag:sgtin-96:1.0614141.012345.6789. Decode this code to see it taken apart again.

How we check: our encoder gives GS1’s published answer for the standard’s own example (urn:epc:tag:sgtin-96:3.0614141.812345.6789 is 3074257BF7194E4000001A85), and a second encoder, written separately bit by bit, gives the same answer as the first for the example above.

Filter values

The filter is a number from 0 to 7 that tells readers what kind of thing a tag is on, so a reader at a dock door can pick out the cases and pallets and leave the single items alone. It isn’t part of the product’s identity: two tags that differ only in their filter carry the same product and serial number. For an SGTIN, the GS1 EPC Tag Data Standard gives the values these meanings:

ValueWhat it marks
0All others
1Point of sale (POS) trade item: an item sold at the till. The usual choice for retail.
2Full case for transport
3Reserved (not offered here)
4Inner pack trade item grouping for handling
5Reserved (not offered here)
6Unit load, such as a pallet
7Unit inside a trade item, or a part inside a product, not sold on its own

If a retailer tells you which value to use, use that one.

Which partition, and how long is my company prefix?

The company prefix and the item reference always add up to 13 digits, but where one ends and the other begins depends on how long your GS1 Company Prefix is. The partition value records that split:

Company prefixPartitionItem reference
12 digits01 digit
11 digits12 digits
10 digits23 digits
9 digits34 digits
8 digits45 digits
7 digits56 digits
6 digits67 digits

Your prefix length is on the certificate or welcome email from GS1, or in your GS1 account. A U.P.C. Company Prefix gets a 0 in front, so it is one digit longer. A barcode number bought on its own (a single GTIN) is encoded as a 12-digit prefix. Please don’t guess: each length gives a different tag code, and a wrong one still decodes to the right barcode number, so the mistake only shows when a retailer’s system doesn’t recognize the tag.

A printer file (ZPL) for that tag

For Zebra RFID printers this page writes ZPL, the printer’s own language. This is the file it makes for the example tag on a 4 × 2 inch label at 203 dpi, with the UPC-A printed on the label:

^XA
^CI28
^PW812
^LL406
^LH0,0
^RS8
^RFW,H^FD3034257BF40C0E4000001A85^FS
^BY3
^FO263,12^BUN,200,Y,N,Y^FD61414112345^FS
^PQ1
^XZ
  • ^RS8 sets the printer up for UHF (Gen 2) RFID tags.
  • ^RFW,H writes what follows in ^FD to the tag’s EPC memory, given in hex.
  • ^BU prints the UPC-A. It is given the first 11 digits, and the printer adds the check digit.
  • ^PW812 and ^LL406 are the label’s width and length in printer dots (4 and 2 inches at 203 dpi), and ^PQ1 prints one label.

We build this file from Zebra’s published command reference and have not run it on a printer ourselves. Print one label and check it with an RFID reader before you run a batch.

Good to know

Can this page write my RFID tags?

No. A web page can’t write a UHF RFID chip by itself. Your RFID label printer does that while it prints, or an RFID encoder does it. This page works out the exact code and gives you a ready-made file for the printer, and a spreadsheet file for other label software and encoding services.

Which printers can use the printer file?

The file is ZPL, for Zebra RFID printers. We build it from Zebra’s published command reference and have not run it on a printer ourselves, so print one label and check it with an RFID reader before you run a batch.

Your printer must be an RFID model, loaded with RFID labels, and calibrated for those labels. If a tag can’t be written the printer prints VOID on it and tries the next label, so a job can use more labels than it has tags. For other makes of printer, use the CSV with that printer’s own label software.

How should I choose serial numbers?

A serial number must never repeat for the same product: not in a later print run, and not on a label someone else makes for you. The simple way is to count up from 1 and keep a note of the last number you used. This page only knows the numbers it makes for you now; it can’t know which ones you used before.

I sell to a retailer with an RFID program. Is this enough?

Retail RFID programs ask for an SGTIN-96 code made from the product’s real barcode number, with a serial number for each item, and that is the code this page works out. The rest is the retailer’s to decide: which tag, where it goes on the product, and whether it must be locked. Their rulebook changes from time to time, so ask them or your label supplier. This page never locks a tag.

Which kinds of code does this page know?

SGTIN-96, SGTIN-198, SSCC-96, SGLN-96, GRAI-96, GIAI-96, GID-96 and plain text written as hex. It follows the layout of the GS1 EPC Tag Data Standard, and SGTIN-96 is checked against GS1’s published example values. The newer “+” schemes of that standard are not supported.

What counts toward the labels each month?

Free for up to 100 labels a month. No account needed. Each tag you take away from this page (with Copy all, a CSV or Excel file, or a printer file) counts as one label. Working out codes, decoding and copying a single code never count, and the same tags again within a day are not counted twice.

EncodeLabel is not affiliated with GS1, Zebra or any retailer.

Suggestions and feedback

What would make EncodeLabel better, or what isn’t working? It goes straight to the people who run the site.

Only if you’d like a reply.

We use your email only to reply to you. Please don’t include passwords or private details. Privacy Policy

Add EncodeLabel to your Home Screen

One tap to your labels, like an app, with nothing to download from an app store.