Base45 is a binary-to-text encoding defined in RFC 9285 that uses a 45-character alphabet chosen to fit the QR code alphanumeric mode. It is the encoding behind the EU Digital COVID Certificate, where it shrinks a signed, compressed payload into the smallest possible QR code. This tool encodes UTF-8 text into Base45 and decodes Base45 back, all in your browser.
How it works
Base45 processes the input two bytes at a time:
- Two bytes form a 16-bit number
n(range 0 to 65535). That number is written in base 45 as three digits:c0 = n mod 45,c1 = (n / 45) mod 45,c2 = n / 2025. The digits are emitted least-significant first. - A single leftover byte (range 0 to 255) is written as two base-45 digits:
c0 = n mod 45andc1 = n / 45. - Each digit is mapped through the fixed alphabet
0-9 A-Zplus the symbolsspace $ % * + - . / :.
Decoding reverses this: groups of three characters rebuild a 16-bit value (two bytes), and a trailing group of two characters rebuilds one byte. A group of three must not exceed 65535, and a final pair must not exceed 255, or the input is rejected.
Why Base45 was designed for QR codes
A QR code can store data in several modes: numeric (digits only), alphanumeric (digits plus a specific 45-character set), binary (raw bytes), and kanji. The alphanumeric mode is more efficient than binary for the same data because it packs two characters per 11 bits instead of one byte per 8 bits. The 45 characters in QR alphanumeric mode are exactly 0-9, A-Z, space, $, %, *, +, -, ., / and : — which is also the Base45 alphabet. By restricting the encoding to those 45 characters, Base45-encoded data fits into QR alphanumeric mode natively, producing a smaller and denser QR code than Base64 would.
The EU Digital COVID Certificate connection
The EU DCC (also called the Green Pass) stores a CBOR-encoded signed health certificate, compressed with ZLIB and then Base45-encoded. The resulting string is prefixed with HC1: and rendered as a QR code. Decoders scan the QR, strip the prefix, Base45-decode it, decompress it, and parse the CBOR to verify the signature and read the certificate. This chain is why Base45 was standardised in RFC 9285 in 2022 — the EU needed a concrete, interoperable spec for the encoding step.
Worked example
Encoding the text AB gives BB8, and encoding base-45 gives UJCLQE7W581 — both are the standard RFC 9285 test vectors.
Because every two input bytes become three output characters, a Base45 string is about 50% longer than the raw bytes. However it still beats Base64 (which adds 33% overhead) once it is placed inside a QR code, because the QR alphanumeric mode stores it more efficiently than QR binary mode would store the same Base64 string.
Invalid input detection
If you paste a Base45 string whose length divided by 3 leaves a remainder of 1, the tool flags it as malformed — no valid encoding ever produces that shape, since input is processed two bytes at a time (3 chars) with at most one leftover byte (2 chars).