Skip to content
barcoder

Standards/mailmark

Mailmark

Type4-State Postal
PrimaryGB
Completeness73%high

Overview

Mailmark is Royal Mail's barcode for UK business and bulk mail. A mailer prints it on each letter, large letter or parcel to get the Mailmark prices of Royal Mail's Retail and Network Access services. The barcode gives every item a unique ID, so Royal Mail can report on that item as it moves through its network 13. Mailmark is not one symbol but a family 12:

  • 2D Mailmark barcodes: a Data Matrix ECC 200 symbol (ISO/IEC 16022), which Royal Mail calls a Complex Mail Data Mark (CMDM). It comes in three sizes, Types 7, 9 and 29, and the larger ones leave room for the customer's own data 1.
  • 4-state Mailmark barcodes: barcode C (66 bars) and barcode L (78 bars), for mailers who cannot print 2D codes. They have no space for customer data 1.

Franking machines print a 2D Mailmark too: since 1 January 2023 Royal Mail has accepted franked mail only from Mailmark franking machines 9.

The slug covers the Royal Mail barcode family as a whole. It is a proprietary Royal Mail specification, published free as PDF documents. The 2D form rests on the ISO Data Matrix symbology; Royal Mail calls the 4-state form a "non-industry standard" barcode 1.

History

  • Origins as EIB (2013–2014). Royal Mail developed the system as the Enterprise Intelligent Barcode (EIB). In a notice published before launch (the PDF dates from September 2013) it said 47 "Early Adopter" companies had worked with it on the new Mailmark, that the first mailings were scheduled for early 2014, and that a second wave was open to businesses posting at least 30,000 letters or 5,000 large letters a day 3. The barcode C instructions name a Lockheed Martin and Royal Mail "Enterprise Intelligent Barcode Long Form Contract" as the basis of the document 2.
  • Specifications (2015). The barcode C encoding and decoding instructions, Release 1b, took effect on 1 September 2015. The release changed the brand from Mailmark™ to Mailmark® 2.
  • Retiring the old Customer Barcode (2015–2018). From 29 May to 7 September 2015 Royal Mail consulted on withdrawing the older 4-state Customer Barcode (CBC, the RM4SCC option). It proposed withdrawal in January 2017, and twenty parties responded. On 14 October 2015 it pushed the date back a year, to January 2018 4. A Royal Mail Wholesale letter of 12 June 2017 confirmed that the Access 70 CBC service would stop on 1 January 2018 5. Royal Mail's technical site told customers that the CBC option would not be available after 31 December 2017, and recommended Mailmark or the OCR option instead 6.
  • Current definition (2020–2025). The current Mailmark Barcode Definition Document dates from September 2020: the 2020 issue is dated 25 September 2020 8, while version 1.6 gives its first issue as 24 September 2020. Version 1.6, issued on 23 April 2025, added Class values for NHS Mailmark postings 1.
  • Franking (2023). From 1 January 2023 Royal Mail accepted franked mail only from machines that print a Mailmark 2D barcode 9.
  • All Access mail barcoded (2025–2026). On 3 November 2025 Royal Mail Wholesale said about 97% of Access volume was already posted on barcoded products. It removed the non-Mailmark variant of Catalogue Mail from 3 August 2026, aiming for all Access mail to carry a barcode 7.

Barcoded stamps (2021–2023)

Royal Mail also put a 2D barcode on its everyday stamps. Royal Mail's documents do not call this barcode a Mailmark.

  • Pilot (2021). Barcodes went on about 20 million 2nd Class stamps, sold to businesses from 23 March 2021. Each barcode sat beside the stamp design, separated by a printed fake perforation 10.
  • All definitives (2022). On 1 February 2022 Royal Mail announced unique barcodes on all definitive stamps. Its first "video stamp", a 30-second Shaun the Sheep film by Aardman, plays when the stamp is scanned in the Royal Mail app 11.
  • Old stamps withdrawn (2022–2023). A Swap Out scheme opened on 31 March 2022. Non-barcoded definitives stopped being valid on 31 January 2023, but a six-month grace period followed. After 31 July 2023, mail with them was treated as underpaid. Royal Mail said the barcodes would bring operational efficiencies and new security features 12.
  • What the code holds. BleepingComputer, which decoded several barcoded stamps, reported in April 2024 that each holds a unique 56-character identifier in a Data Matrix, beginning JGB S. That is the same JGB UPU prefix as 2D Mailmark 13. Royal Mail has not published the stamp payload layout. Its Mailmark definition lists no Information Type "S" 1.

Technical specification

2D Mailmark barcodes (CMDM)

A 2D Mailmark barcode is a Data Matrix ECC 200 symbol to ISO/IEC 16022:2006. A reader tells it apart from other Data Matrix codes on the item by its first six characters 1. The three sizes are 1:

Type Modules Size at 0.5 mm modules Size at 0.7 mm modules Total capacity (C40) Customer content
7 24 × 24 12 × 12 mm 16.8 × 16.8 mm 51 characters 6 characters
9 32 × 32 16 × 16 mm 22.4 × 22.4 mm 90 characters 45 characters
29 16 × 48 8 × 24 mm 11.2 × 33.6 mm 70 characters 25 characters

Modules must be 0.50–0.70 mm (Royal Mail recommends 0.5 mm, 6 dots at 300 dpi), and the code needs a quiet zone of at least four modules 1. Error correction is Data Matrix ECC 200's Reed–Solomon coding 1.

Encoding. The data is one continuous string with no header, footer or data identifiers, and it does not use the ISO/IEC 15434 or 15418 message structures. The Royal Mail fields must be encoded in Data Matrix's C40 basic set (upper-case letters, digits and space), starting from the beginning of the string. The customer content may use other encodations, such as punctuation for a web address, at the cost of space 1. Every field has a fixed length and position, and empty fields are filled with spaces. The one exception is unused customer space, which is left out to keep more error correction 1.

Field layout (Definition Document Table 2; positions are 1-based) 1:

Pos. Len. Field Values
1 4 UPU Country ID JGB (J = UPU identifier, GB = Royal Mail)
5 1 Information Type ID 0 domestic sorted and unsorted; 1 international sorted and unsorted; 2 response services; A online postage; B franking; C consolidation (some values reserved for future use)
6 1 Version ID currently 1
7 1 Class 0 null/test; 1 1C; 2 2C; 3 Economy; 4 Premium; 5 Deferred; 6 Air; 7 Surface (all Retail); 8 Premium: Priority and 9 Standard (Network Access); A NHS Standard; B NHS 2C; E 4 Day Economy; F NHS Priority; G NHS 1C; C, D, H–Z spare
8 7 Supply Chain ID 0000000–9999999: the group of customers involved in the mailing
15 8 Item ID 00000000–99999999: must identify the item uniquely for at least 90 days
23 9 Destination postcode + DPS postcode with Delivery Point Suffix in a valid PAF format; default DPS 9Z; all spaces if unknown; XY991AA for the supplementary default postcode; XY11 plus spaces for international (future use)
32 1 Service Type 0 letter; 1 large letter; 4 parcel
33 7 Return-to-sender postcode full postcode without DPS, or 7 spaces
40 6 Reserved spaces
46 — Customer content optional; up to 6 / 45 / 25 characters for Types 7 / 9 / 29

The Royal Mail part is therefore 45 characters long. Royal Mail's own example (Tables 4 and 5) is JGB + 0 + 1 + 2 + 1001234 + 12345678 + AB19XY1A + 0 + 7 spaces + 6 spaces, followed by customer content such as REFERENCE 12300AB or www.xyz.com 1. Royal Mail says the data is not sensitive and is not encrypted, and that customer content is not passed into Mailmark Analytics 1.

4-state Mailmark barcodes (C and L)

The 4-state Mailmark barcode looks like the old CBC, but Royal Mail stresses that its content and the way it is produced differ. It is "no longer a direct character font solution": the data is converted to numbers and protected by Reed–Solomon codes, at least 25% error correction 1.

Barcode C Barcode L
Who uses it consolidators of machine-readable Low Sort Retail and Access 70 mail all customers of machine-readable Low Sort and Unsorted Retail and Access 70 mail
Bars 66 78
Length (21.2 bars per inch) about 76.2 mm about 89 mm
Input string 22 characters 26 characters
Supply Chain ID 2 digits 6 digits
Reed–Solomon 16 data numbers, 6 check numbers 19 data numbers, 7 check numbers

Sources: the Definition Document 1, the barcode C instructions 2 and, for barcode L's Reed–Solomon counts, BWIPP's encoder 15. Either form can also go on Manual Mailmark parcels and large letters. If an item carries both, the consolidator code wins 1.

Input fields. Format (1: 0 test, 1 letter, 2 large letter, 4 parcel), Version ID (1, 1), Class (1), Supply Chain ID (2 or 6), Item ID (8) and Destination postcode + DPS (9). The postcode must reach at least unit level and be padded with spaces to nine characters. XY72LT9Z is used when the address is not in PAF, and XY11 for international mail 1.

Encoding steps (barcode C) 2:

  1. Each field is turned into an integer. Only six character patterns are allowed for the postcode, for example FNFNLLNLS, where F is A–Z, L is the 20 letters ABDEFGHJLNPQRSTUWXYZ, N is a digit and S is a space. The international string XY11 encodes as 0.
  2. The fields are packed into one 79-bit value, with the postcode most significant and the Version ID least.
  3. The value is split into 16 data numbers for GF(32): nine take 30 values and seven take 32, which helps synchronisation and orientation.
  4. Six check numbers are computed with the primitive polynomial x⁵ + x² + 1 and the generator x⁶ + 17x⁵ + 26x⁴ + 30x³ + 27x² + 30x + 24.
  5. The numbers become 6-bit symbols and are reordered into 22 "extender groups", spread so that a misread is less likely to decode.
  6. Each group sets the ascenders and descenders of three bars. The result is 66 bar identifiers: A ascender, D descender, F full, T tracker.

The instructions give worked examples. With the minimal input 1100000000000XY11 the packed value is 4 2. Royal Mail supplies its own 4-state encoders, decoders and a "4State Jack 1 barcode" font that prints the D/A/F/T string as bars 1.

A version mismatch. The 2015 barcode C algorithm encodes Class as one of 15 values, 0–9 and A–E 2. BWIPP and Zint accept the same set 1517. The 2025 Definition Document, however, also lists NHS Class values F and G for 4-state barcodes 1. None of the fetched sources explains how those values are encoded.

Use cases

  • Bulk business mail with item-level reporting. Royal Mail's case for the barcode was that a business would know the day its statements and business mail were due to arrive. Call centres could be staffed around that date, a text or email could go out on delivery day, and the response to marketing mail could be measured. Before Mailmark, that information came only with dearer tracked services 3.
  • Mailmark pricing. A Mailmark barcode is required for the Mailmark options of the Retail and Network Access portfolios 1. Royal Mail priced Mailmark and OCR mail below the old CBC barcode 6.
  • Franking. Information Type B is franking 1. Franking machines that print a Mailmark 2D barcode have been the only ones accepted since 1 January 2023 9.
  • Customer data. Mailers can use the spare space in a 2D code to manage printing, sort opened mail and scans, handle returns and people who have moved away, tag campaigns, or let recipients scan the code with a phone 1.
  • NHS mail. Version 1.6 added NHS Standard, NHS Priority, NHS 1C and NHS 2C classes for NHS Mailmark postings 1.

Implementations

Project Language Stars Last active Mailmark support
bwipp/postscriptbarcode (BWIPP) PostScript 504 Oct 2026 mailmark (2D) since 24 Sep 2019 14; mailmark4state (C and L) added 13 Oct 2026 1516
metafloor/bwip-js JavaScript 2431 Aug 2026 ports BWIPP; its README lists mailmark (Royal Mail Mailmark) but no 4-state encoder 18
zint/zint C 827 Oct 2026 BARCODE_MAILMARK_4S and BARCODE_MAILMARK_2D 17
zxing-cpp/zxing-cpp C++ 2089 Nov 2026 reads Data Matrix ECC 200, so it reads a 2D Mailmark as plain Data Matrix; it lists no postal 4-state symbology 19

Star counts were read from the GitHub API on 6 November 2026.

  • BWIPP mailmark. The encoder takes type 7, 9 or 29, mapped to Data Matrix sizes 24x24, 32x32 and 16x48 (rectangular). It checks only that the input starts with JGB and has at least 45 characters, then C40-encodes the first 45 characters 14. mailmark4state checks the length (22 or 26), the Version ID and the postcode pattern 15.
  • Zint pads the 2D input with spaces and adds JGB when it is missing. It chooses the size from the customer data, or takes --vers = Royal Mail Type + 1 (8, 10, 30). It lists Type 29's customer space as 29 characters, where Royal Mail's document gives 25 171.
  • OkapiBarcode (Java) supports RM4SCC but lists no Mailmark symbology 20.
  • Royal Mail supplies 4-state encoders and decoders to customers, and says CMDM encoders and decoders are widely available on the market, provided they can encode C40 1.

About the Try-it encoder

The playground uses bwip-js's mailmark with type 29, so it draws a 16 × 48 Data Matrix. Its sample string, JGB 012100123412345678AB19XY1A 0 www.xyz.com, is BWIPP's own example for the encoder 14. That example is in turn Royal Mail's Table 5 example from the Definition Document, character for character 1. It fits the published layout:

  • Positions 1–45: JGB , Information Type 0 (domestic), Version 1, Class 2 (2C Retail), Supply Chain ID 1001234, Item ID 12345678, destination AB19XY1A (postcode AB1 9XY, DPS 1A), Service Type 0 (letter), a blank return-to-sender postcode (7 spaces) and the reserved field (6 spaces).
  • Customer content: 11 characters of www.xyz.com, within Type 29's 25.

The encoder does not check the field values, so the playground can draw strings Royal Mail would reject 14. The bwip-js release the site uses cannot draw the 4-state C or L barcodes 18.

Comparison

  • Against the old CBC (RM4SCC). Royal Mail describes the 4-state Mailmark as similar in appearance to the CBC but not in content or method of producing 1. The CBC printed a postcode and DPS as a character font. Mailmark packs a structured record (format, class, supply chain, item ID, postcode and DPS) into numbers protected by Reed–Solomon codes, with at least 25% error correction 12. The unique item ID is what made item-level reporting possible, which CBC mail did not offer 3.
  • 2D or 4-state. Royal Mail offers the 4-state form for customers who cannot print 2D barcodes. It carries the same core fields but no customer data, a 2- or 6-digit Supply Chain ID instead of 7 digits, and no return-to-sender postcode 1. The 2D form adds the service type, the return postcode and up to 45 characters of the customer's own data 1.
  • Against plain Data Matrix. A 2D Mailmark is an ordinary ECC 200 symbol limited to three sizes, 0.5–0.7 mm modules, C40 encoding for the Royal Mail part and the fixed 45-character header. Any Data Matrix reader can decode it, and the header is what marks it as a Mailmark 1.

Fun facts

  • The type numbers come from Data Matrix's own size list. Zint's --vers value for each type is simply the Royal Mail Type plus one: 8 is 24×24, 10 is 32×32 and 30 is 16×48 17.
  • The bar alphabet of the 4-state code is four letters, A, D, F and T. Royal Mail's encoders output that string, and a dedicated font, "4State Jack 1 barcode", draws the bars 12.

Status

Active. The Definition Document was last revised in version 1.6, issued 23 April 2025 1. The old CBC option ended on 1 January 2018 5. In November 2025 about 97% of Network Access volume already carried a barcode, and Royal Mail Wholesale was removing the last non-Mailmark variants 7.

Sources

Deployments

No country reports mention this standard by name.

source · content/standards/mailmark/index.md