← All tools

Free tool

ZATCA QR Code Generator & Reader

Build the QR code a Saudi simplified tax invoice needs, or check one you already have — scan it with your camera, choose a photo or PDF of the invoice, or paste the Base64 if you have it. Everything runs in your browser: an invoice carries a customer, a total and a VAT number, and none of that should be sent to a stranger to encode five fields.

The invoice never leaves your device.

Fill in the five fields and the code appears here.

How to use it

  1. Enter the seller name exactly as it is registered, the 15-digit VAT number, the timestamp, the total including VAT and the VAT portion.
  2. Check the byte count beside the seller name if it is in Arabic — the limit is 255 bytes, not 255 characters.
  3. Download the PNG for printing on a receipt, or copy the Base64 to hand to your invoicing system.
  4. To check an invoice you already have, switch to Read a QR: scan the code with your phone's camera, or choose a photo, a scan or the PDF — a whole A4 page is fine, the code is located within it.
  5. Compare the tags it shows against what you expected — a wrong length or a missing Z on the timestamp is visible immediately.

How it works

ZATCA does not want a URL or a JSON object in the QR. It wants a binary structure called TLV — for each field, one byte of tag, one byte of length, then the value — with all the fields concatenated and the result Base64 encoded. Tags 1 to 5 are the seller name, VAT number, timestamp, total and VAT.

The length byte counts UTF-8 bytes, not characters, and this is where most wrong QR codes come from. An Arabic seller name is roughly two bytes per letter, so a length taken from a string's character count is about half what it should be. Every field after it is then read from the wrong offset, and the code scans perfectly while decoding to nonsense.

Tags 6, 7 and 8 carry the hash of the signed invoice XML, an ECDSA signature over it, and the public key from your ZATCA certificate. This tool cannot produce those and neither can any other browser page: they need the private key that lives inside your e-invoicing system. Paste them in if you have them and they will be appended in order.

Common questions

What are the mandatory fields for a ZATCA Phase 2 QR code?

Tags 1 to 5 — seller name, 15-digit VAT number, ISO 8601 Zulu timestamp, total including VAT, and the VAT amount. Phase 2 adds tags 6, 7 and 8: the invoice XML hash, the ECDSA signature and the public key, all of which come from the signing step.

What is TLV Base64 encoding in Saudi electronic invoicing?

Tag-Length-Value. Each field becomes one byte of tag number, one byte giving the length of the value in bytes, then the value itself. The fields are concatenated and the whole byte string is Base64 encoded. That Base64 is what the QR holds.

Why does a standard online QR code generator fail ZATCA validation?

Because it encodes the text you typed. ZATCA expects the TLV byte structure above, so a QR holding a URL, a JSON object or plain text is well-formed as a QR and meaningless as an invoice. It scans; it does not validate.

Can this sign my invoice or produce tags 6, 7 and 8?

No, and no browser page can. Those need the private key from your ZATCA-issued certificate, which lives in your e-invoicing system. This builds tags 1 to 5 correctly and will append 6 to 8 if you paste them.

Why is my Arabic seller name breaking the QR?

Almost certainly a length counted in characters. The length byte is the UTF-8 byte count, and Arabic is about two bytes per letter, so a name of 11 letters is 21 bytes. Get that wrong and every field after it is read from the wrong place.

Is my invoice data uploaded?

No. The encoding, the QR rendering and the decoding all happen in this tab. Open your browser's network tab and use the tool — nothing is sent. That is the reason this exists rather than the several online ZATCA generators that take your customer's details.

What is the Base64 and where do I get it?

It is the long string of letters and digits stored inside the QR — the invoice's five fields packed into text. You do not have to find it yourself: point your camera at the code, or choose a photo or PDF of the invoice, and this page reads it out of the picture for you.

I only have a paper invoice. Can I still check its QR?

Yes. On a phone, choose Scan with the camera and hold it over the code. On a computer, photograph or scan the invoice and choose the file — a whole A4 page works, because the code is located within it rather than expected to fill the frame. The picture is examined in the browser and never uploaded.

Share
WhatsAppXin