Make an invoice QR code
Everything runs in your browser. Nothing is sent anywhere.
Read an existing code
Who this is for
Developers building an invoicing system who want to check their encoding, and shop owners or accountants who want to understand what the printed code holds.
The generator makes the five base fields. A Phase 2 code adds signature fields that the invoicing system creates with its own private key, which no website can or should do for you.
How the code is built, step by step
- Each field starts with one byte holding the tag number (1 to 5).
- Then one byte with the value's length in UTF-8 bytes, not in characters.
- Then the value itself.
- The fields are joined in order and the whole buffer is converted to Base64.
- That Base64 text is what goes inside the QR code.
The five fields
| Tag | Field | Example |
|---|---|---|
| 1 | Seller name | Rkeb Office Commercial |
| 2 | Seller VAT number | 300089699700003 |
| 3 | Invoice date and time | 2026-10-26T09:15:00Z |
| 4 | Invoice total incl. VAT | 57.50 |
| 5 | VAT amount | 7.50 |
Mistakes we see often
- Counting the length in characters instead of bytes. An Arabic letter takes two bytes in UTF-8, so a 20-letter Arabic name is about 40 bytes.
- Base64-encoding the text before building the TLV. Base64 is the last step, applied to all the bytes.
- A VAT number that is short or has spaces. It is 15 digits.
- A VAT amount that does not match the total. On a simplified invoice, the VAT inside a VAT-inclusive total is the total times 15 divided by 115.
- A value longer than 255 bytes. The length byte cannot hold more, so shorten the name.
Phase 2: what gets added
In Phase 2 the invoicing system adds the invoice hash (tag 6), the digital signature (tag 7) and the public key (tag 8), and on a simplified invoice the certificate signature (tag 9).
These are made on the device that issued the invoice, with a key tied to its certificate from the Fatoora platform. Paste a Phase 2 code in the reader above and you will see them as Base64 bytes.
What to know about the invoice QR code
The code is open
The generator runs entirely in your browser and sends no data. The encoder is published under the MIT license at /js/zatca-tlv.js, and you can use it in your own system.
Sources: E-invoicing roll-out phases: ZATCA
Frequently asked questions
Can I use the code from here on a real invoice?
It uses the same encoding as ZATCA's five fields. A Phase 2 invoice also needs the signature fields made by an invoicing system connected to Fatoora, so use this for testing and learning.
Why is the Arabic name twice as long as its letters?
The length is counted in UTF-8 bytes, and an Arabic letter takes two.
Do you send the invoice data anywhere?
No. Everything is worked out in your browser.
How do I get the VAT from the total?
Multiply the total by 15 and divide by 115, or press the VAT button in the generator.
Related pages
First 500 restaurants, cafés, bakeries and sweet shops: a SAR 99 monthly cap.
Instead of SAR 149, per branch, for a full year. Free to join, no commitment.