Knowledge CenterQR Code Fields Explained

ZATCA QR Code Fields Explained

The QR code on a ZATCA-compliant invoice encodes a TLV (Tag-Length-Value) data structure in Base64. It's not a simple URL — it's a cryptographically verifiable summary of the invoice. Here's what each field contains.

What is TLV encoding?

TLV is a compact binary format. Each piece of data is stored as:

  • Tag — 1 byte identifying the field
  • Length — 1 byte indicating how many bytes the value occupies
  • Value — the actual data (UTF-8 string for most fields)

The entire TLV structure is then Base64-encoded to produce the QR code string.

The six TLV fields

TagFieldContentExample
0x001Seller NameLegal business name in Arabic or EnglishRiyadh Gadgets Trading Co.
0x002VAT Number15-digit VAT registration number310000000000006
0x003TimestampInvoice date and time (ISO 8601)2024-01-15T10:30:00Z
0x004Invoice Total (inc. VAT)Total payable in invoice currency1725.00
0x005VAT AmountTotal VAT in SAR225.00
0x006HashSHA-256 hash of the signed invoice XMLBase64-encoded bytes

Tag 05 — VAT Amount is always in SAR

Even if your invoice is in a foreign currency (e.g. USD), Tag 05 must contain the VAT amount converted to SAR. This is because ZATCA needs to aggregate VAT figures across all filings in the Saudi national currency. Saudi VAT Pro automatically reads the SAR-denominated TaxTotal from the XML to populate this tag correctly.

Tag 06 — the cryptographic hash

Tag 06 is what makes the QR code tamper-evident. It contains a SHA-256 hash of the canonicalized, signed invoice XML. Anyone with the ZATCA verification app can scan the QR code and verify that the printed invoice matches what ZATCA has on record. If the document has been altered after signing, the hash won't match.

Note: Tag 06 is only present on Standard (cleared) invoices. Simplified invoices may omit the signature-based hash but must still include Tags 01–05.

Related: ZATCA Phase 2 Overview

Understand how clearance, signing, and the ICV/PIH hash chain work together before the QR code is generated.

Read guide

QR codes generated automatically

Saudi VAT Pro builds and embeds the correct TLV-encoded QR code on every invoice — no manual encoding needed.

Start Free Trial

Decoding a QR code yourself

To inspect a ZATCA QR code:

  1. Scan the QR code to get the Base64 string
  2. Decode from Base64 to get the raw binary TLV bytes
  3. Parse each TLV triplet: read 1 byte tag, 1 byte length, then N bytes value
  4. Interpret each value as a UTF-8 string (except Tag 06 which is raw bytes)
# Python example
import base64
qr_b64 = "YOUR_QR_STRING_HERE"
raw = base64.b64decode(qr_b64)
i = 0
while i < len(raw):
tag = raw[i]; length = raw[i+1]
value = raw[i+2 : i+2+length]
print(f"Tag {tag:02x}: {value.decode('utf-8', errors='replace')}")
i += 2 + length