How to use the base45 encoder decoder
- Select Encode or Decode from the mode dropdown.
- Paste your plain text or Base45 string into the input area.
- The result updates automatically as you type.
- Copy the output for use in QR codes, CBOR Web Tokens or other applications.
How Base45 encoding works
RFC 9285 defines Base45 as a method to convert binary data into printable ASCII characters. The algorithm processes input bytes in pairs. Two bytes form a 16-bit value (first byte times 256 plus second byte), which is then converted to base 45 by repeated division. The three remainders map to characters in the Base45 alphabet.
For example, to base45 encode the two bytes A (65) and B (66): the combined value is 65 * 256 + 66 = 16706. Dividing by 45 gives quotient 371 remainder 11 (character B). Dividing 371 by 45 gives quotient 8 remainder 11 (character B). The final quotient 8 maps to character 8. Reading the remainders from least significant to most significant yields BB8.
If the input has an odd number of bytes, the final byte is encoded alone as a value from 0 to 255, producing exactly two Base45 characters.
The Base45 alphabet
Base45 uses 45 specific characters chosen to be safe in QR code Alphanumeric mode. The mapping from index 0 to 44 is:
| Index | Character | Index | Character | Index | Character |
|---|---|---|---|---|---|
| 0 | 0 | 15 | F | 30 | U |
| 1 | 1 | 16 | G | 31 | V |
| 2 | 2 | 17 | H | 32 | W |
| 3 | 3 | 18 | I | 33 | X |
| 4 | 4 | 19 | J | 34 | Y |
| 5 | 5 | 20 | K | 35 | Z |
| 6 | 6 | 21 | L | 36 | space |
| 7 | 7 | 22 | M | 37 | $ |
| 8 | 8 | 23 | N | 38 | % |
| 9 | 9 | 24 | O | 39 | * |
| 10 | A | 25 | P | 40 | + |
| 11 | B | 26 | Q | 41 | - |
| 12 | C | 27 | R | 42 | . |
| 13 | D | 28 | S | 43 | / |
| 14 | E | 29 | T | 44 | : |
Notice that lowercase letters are not part of the alphabet. When you base45 encode text, only uppercase letters, digits and these few symbols appear in the output.
Why use Base45 instead of Base64
QR codes support several encoding modes. The Alphanumeric mode can store 45 characters natively, packing more data per module than Byte mode. Because Base45 uses exactly those 45 characters, a Base45-encoded payload fits perfectly into QR Alphanumeric mode without triggering the less efficient Byte mode fallback.
This property makes Base45 the preferred encoding for EU Digital Green Certificates (health passes) and CBOR Web Tokens transmitted via QR codes. Compared to Base62 or Base58, Base45 is specifically optimized for this QR constraint rather than general URL safety or visual ambiguity avoidance.
Common mistakes when decoding Base45
Decoding failures usually come from invalid characters or incorrect string length. Every complete pair of input bytes produces exactly three Base45 characters. Therefore, a valid Base45 string must have a length that is a multiple of three, or a multiple of three plus two (for a trailing single byte). A string whose length modulo 3 equals 1 is always invalid.
Another frequent issue is including characters outside the 45-character alphabet. Lowercase letters, commas, semicolons and exclamation marks will cause a decode error. Always verify that the source string contains only the characters listed in the alphabet table above before attempting to decode.
Technical details and limits
The expansion ratio of Base45 is approximately 1.5:1 for large inputs, since every 2 bytes become 3 characters. This is slightly worse than Base64 (which expands 3 bytes to 4 characters, a 1.33:1 ratio), but the trade-off is worthwhile when the target medium is a QR code in Alphanumeric mode.
This tool handles arbitrary-length text input. For binary data such as images or compressed files, you would first need to represent the bytes as a string, which is beyond the scope of a text-based encoder. For general-purpose binary-to-text needs where QR optimization is not required, consider Base64 instead.
Worked examples
| Example | Input | Result |
|---|---|---|
| Encode "AB" | Mode: encode; Input: AB | BB8 |
| Decode "BB8" | Mode: decode; Input: BB8 | AB |
| Encode "Hello!!" | Mode: encode; Input: Hello!! | %69 VD92EX0 |
FAQ
What is Base45 encoding?
Base45 is a binary-to-text encoding defined in RFC 9285. It converts byte sequences into strings using a 45-character alphabet optimized for QR code Alphanumeric mode.
How do I base45 encode a string?
Select Encode mode, type or paste your text into the input field, and the tool instantly produces the Base45 representation. Each pair of bytes becomes three characters.
Is Base45 the same as Base64?
No. Base64 uses 64 characters and is common for email attachments and web APIs. Base45 uses 45 characters specifically chosen to match the QR code Alphanumeric character set.
Can Base45 handle Unicode text?
Yes. The encoder first converts the input text to UTF-8 bytes, then applies the Base45 algorithm to those bytes. Decoding reverses the process, restoring the original Unicode characters.
Why does my Base45 decode fail?
The input likely contains characters outside the Base45 alphabet or has an invalid length. Valid Base45 strings have a length that is a multiple of 3, or a multiple of 3 plus 2.
Where is Base45 used in practice?
Its primary use is encoding CBOR Web Tokens inside QR codes, notably for the EU Digital Green Certificate. Any application that needs maximum data density in QR Alphanumeric mode benefits from Base45.