# ZATCA QR code generator and decoder

> Enter seller, VAT number, timestamp, total and VAT to get the TLV Base64 string and a QR code, or paste a Base64 string to read tags 1 to 9. Everything runs in your browser.

- Web page: https://raqambooks.com/tools/zatca-qr-generator/
- Last updated: 2026-12-05
- Published: 2026-12-01
- Other languages: [ar](https://raqambooks.com/ar/tools/zatca-qr-generator.md), [ur](https://raqambooks.com/ur/tools/zatca-qr-generator.md)

## Generate or decode a ZATCA QR code

**Summary:** The Encode tab builds the five ZATCA QR fields as TLV, converts them to Base64 and draws a downloadable QR image. The Decode tab reads any Base64 string and labels tags 1 to 9, showing signature and key tags as hex. It runs in your browser, so invoice data is never uploaded.

> Interactive tool: runs in the browser, nothing is uploaded. Use the web page.

## How the TLV Base64 string is built

**Summary:** Each field is stored as three parts: a one-byte tag number, a one-byte length and the value in UTF-8. Tags 1 to 5 carry seller name, VAT number, timestamp, invoice total and VAT amount. The parts are joined and Base64-encoded. Because the length is one byte, no value can exceed 255 bytes.

**ZATCA QR tags handled by the tool**

| Tag | Field | Content | Used in |
| --- | --- | --- | --- |
| 1 | Seller name | UTF-8 text; Arabic names are normal | Phase 1 and 2 |
| 2 | VAT registration number | 15 digits | Phase 1 and 2 |
| 3 | Timestamp | ISO 8601 date and time | Phase 1 and 2 |
| 4 | Invoice total including VAT | Decimal text, for example 1150.00 | Phase 1 and 2 |
| 5 | VAT amount | Decimal text, for example 150.00 | Phase 1 and 2 |
| 6 | Invoice hash | Binary, shown as hex by the decoder | Phase 2 |
| 7 | ECDSA digital signature | Binary, shown as hex | Phase 2 |
| 8 | Public key | Binary, shown as hex | Phase 2 |
| 9 | Certificate signature | Binary, shown as hex | Phase 2, simplified invoices |

## Worked example, byte by byte

**Summary:** For seller Sample, VAT number 300000000000003, timestamp 2026-12-03T10:30:00Z, total 1150.00 and VAT 150.00, the TLV data is 64 bytes: five two-byte headers plus 54 bytes of values. Base64 turns those 64 bytes into an 88-character string starting AQZTYW1wbGU. The generator produces exactly that output.

The value 300000000000003 is a dummy number for the example. Do not print sample data on real invoices. A name in Arabic works the same way, but each Arabic letter takes 2 bytes in UTF-8, so the length byte counts bytes, not characters.

```
01 06 53616d706c65                          tag 1, 6 bytes:  Sample
02 0f 333030303030303030303030303033        tag 2, 15 bytes: 300000000000003
03 14 323032362d31322d30335431303a33303a30305a  tag 3, 20 bytes: 2026-12-03T10:30:00Z
04 07 313135302e3030                        tag 4, 7 bytes:  1150.00
05 06 3135302e3030                          tag 5, 6 bytes:  150.00

AQZTYW1wbGUCDzMwMDAwMDAwMDAwMDAwMwMUMjAyNi0xMi0wM1QxMDozMDowMFoEBzExNTAuMDAFBjE1MC4wMA==
```

## Common errors and what this tool does not do

**Summary:** Typical failures are a VAT number that is not 15 digits, a seller name over 255 UTF-8 bytes, a timestamp that is not ISO 8601, and Base64 that was cut or edited. The tool only builds and reads QR text. It does not stamp, clear or report invoices, which needs ZATCA onboarding and a signing flow.

- **The VAT number is rejected**: It must be exactly 15 digits. Remove spaces and dashes and check for a missing digit.
- **The seller name is too long**: A tag value holds at most 255 bytes. Arabic letters take 2 bytes each, so a long Arabic trade name can hit the limit sooner than a Latin one.
- **The timestamp is wrong**: Use ISO 8601 with a T between date and time, for example 2026-12-03T10:30:00Z. The Use current time button fills it in.
- **Decode says a length is too large**: The Base64 text was probably cut, edited or double-encoded. TLV lengths are a single byte, so the declared length can never legitimately exceed 255.

> **A QR code is not compliance** Generating a QR code does not register, clear or report an invoice. In Saudi Arabia, Phase 2 standard invoices are cleared by ZATCA before they are issued and simplified invoices are reported within 24 hours, using the cryptographic stamp from onboarding in the ZATCA Fatoora portal. See the [ZATCA compliance guide](https://raqambooks.com/compliance/zatca-saudi-arabia/).

## When to use the desktop app instead

**Summary:** A QR code made by hand suits testing and one-off documents. For daily invoicing, the RaqamBooks desktop app generates the ZATCA TLV Base64 QR code on each invoice, produces UBL 2.1 XML, archives issued documents locally and works offline. Clearance and reporting remain separate steps you complete with ZATCA.

The app prints the QR on bilingual PDF invoices and receipts, so staff never copy Base64 strings by hand. Read how invoices, credit notes and QR codes fit together on the [invoicing feature page](https://raqambooks.com/features/invoicing/), see the Saudi rules on the [Saudi Arabia page](https://raqambooks.com/gcc/saudi-arabia/), or [download the app](https://raqambooks.com/download/) and try it offline.

## Frequently asked questions

**What is a ZATCA QR code?**

It is a QR code printed on Saudi e-invoices that holds the invoice's key facts as a Base64 string of TLV data. Phase 1 simplified invoices carry five fields: seller, VAT number, timestamp, total and VAT. Phase 2 adds signature-related tags.

**Which fields does the QR code contain?**

Tags 1 to 5 are seller name, VAT registration number, timestamp, invoice total including VAT and VAT amount. Phase 2 adds tags 6 to 9: invoice hash, ECDSA digital signature, public key and, for simplified invoices, the certificate signature.

**Can the seller name be in Arabic?**

Yes. Text tags are UTF-8, and Arabic seller names are normal. The 255-byte limit counts bytes, and an Arabic letter takes 2 bytes, so roughly 120 Arabic letters plus spaces fit. The tool shows the bytes used as you type.

**Does this make my invoice ZATCA compliant?**

No. The tool only encodes and decodes QR text. Compliance also depends on structured invoice formats, onboarding in the ZATCA Fatoora portal, cryptographic stamping and clearance or reporting, depending on your wave and invoice type. Confirm requirements with ZATCA.

**Is my invoice data uploaded or stored?**

No. The TLV bytes, Base64 string and QR image are all created in your browser. No request is sent with your seller, VAT number or amounts, and nothing is saved. Reloading the page clears every field.

## Related pages

- [ZATCA e-invoicing](https://raqambooks.com/compliance/zatca-saudi-arabia/): Guide to ZATCA FATOORA e-invoicing in Saudi Arabia: Phase 1 vs 2, Wave 25, clearance vs reporting, UBL 2.1 XML, TLV QR tags and a readiness checklist.
- [Saudi Arabia](https://raqambooks.com/gcc/saudi-arabia/): Offline desktop ERP for Saudi Arabia: Arabic-first SAR invoices, 15% VAT, UBL 2.1 XML, ZATCA TLV QR codes and a Phase 2 clearance and reporting workflow.
- [Invoicing & E-Invoicing](https://raqambooks.com/features/invoicing/): Issue bilingual English/Arabic PDF invoices with UBL 2.1 XML, ZATCA-format QR codes and linked credit notes. Works offline on Windows and macOS.
- [Bilingual invoice maker](https://raqambooks.com/tools/bilingual-invoice-maker/): Free printable English-Arabic invoice and quotation template for the GCC: line items, VAT per line and exact 2- or 3-decimal totals. Runs in your browser.
- [Download](https://raqambooks.com/download/): Choose your country edition of RaqamBooks, an early version, and download the Windows or Mac installer. SHA-256 checksums are published; it works offline.

## Download RaqamBooks and run your business offline

Install it on your own computer, keep your data local and avoid per-user monthly cloud fees. Early version for Windows 10/11 and macOS 13 or later (Apple chip and Intel chip).

[All downloads, checksums and install guide](https://raqambooks.com/download/)
