The ZATCA QR code generator above builds the code that phase 1 of e-invoicing in Saudi Arabia puts on a simplified tax invoice. It carries five fields: the seller name, the seller VAT number, the invoice date and time, the total including VAT and the VAT amount. Enter them and the code appears on a sample receipt, together with the Base64 text it holds and a table that breaks the fields down tag by tag. Use it to check a code your own system prints, or to see what ZATCA's app reads when it scans your invoice.
How a ZATCA QR code is built with TLV encoding
TLV (Tag-Length-Value) puts two bytes in front of every value: the tag number from 1 to 5, then the length of the value in bytes after UTF-8 encoding. Latin letters and digits take one byte each, while each Arabic letter takes two, so a seller name written in Arabic comes out at about twice its character count. Once the five fields are joined, the whole byte string is converted to Base64.
[Tag 1 byte][Length 1 byte][Value UTF-8] × 5 → Base64 → QR
E-invoice QR code in phase 1 and phase 2
In phase 1 (generation) a simplified tax invoice carries a code with the five fields, according to the ZATCA FAQ. In phase 2 (integration) the code grows to nine tags, as the e-invoicing detailed guideline sets out: the first five, plus the invoice hash, the digital signature, the public key and the signature of the stamp certificate. Those four extra tags cannot be typed by hand; they come from an e-invoicing solution that holds a certificate from ZATCA. That is why this generator deliberately stops at phase 1.
What ZATCA's app reads when it scans the code
The authority used to be called GAZT (the General Authority of Zakat and Tax) and is now the Zakat, Tax and Customs Authority; the code itself did not change with the name. When a buyer scans it with ZATCA's app or any QR reader, the app decodes the Base64 text and shows the five fields. Seeing those fields does not mean the invoice is registered with ZATCA, since anyone can generate them; real verification in phase 2 relies on the digital signature.
Common mistakes in an invoice QR code
- Writing the field length as a character count instead of a byte count, so an Arabic seller name is read cut short.
- A VAT number with 14 digits or with spaces; the correct format is 15 digits starting and ending with 3.
- The total before VAT in field 4, where the total including VAT belongs.
- A date with no time, or in local time with no time zone offset.
- Drawing a link to an invoice page into the code instead of the Base64 text.
What to do after you generate the code
Download the code as a PNG to drop into a document, or as an SVG if you want to print it large without it blurring. If you are checking a code your own system prints, copy the Base64 text from the generator and compare it with the text your system produces for the same invoice: any difference means one of the fields is written another way. To read the code on an invoice you received, use the e-invoice reader.
When you need a phase 2 code
A business whose integration wave comes due needs invoices that leave a compliant solution, signed and sent to the FATOORA platform; a hand-generated code is not enough. At Microtec we offer accounting software (ERP) that brings sales, purchasing, inventory and finance together, and our solutions are approved by the Zakat, Tax and Customs Authority. Try it before your wave comes due.