Xerobit

Base45 Encode and Decode

Use this tool to base45 encode plain text into a compact alphanumeric string, or decode a Base45 string back to its original bytes. It implements RFC 9285 and runs entirely in your browser, so nothing is uploaded to any server.

Result

How to use the base45 encoder decoder

  1. Select Encode or Decode from the mode dropdown.
  2. Paste your plain text or Base45 string into the input area.
  3. The result updates automatically as you type.
  4. 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:

IndexCharacterIndexCharacterIndexCharacter
0015F30U
1116G31V
2217H32W
3318I33X
4419J34Y
5520K35Z
6621L36space
7722M37$
8823N38%
9924O39*
10A25P40+
11B26Q41-
12C27R42.
13D28S43/
14E29T44:

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

ExampleInputResult
Encode "AB"Mode: encode; Input: ABBB8
Decode "BB8"Mode: decode; Input: BB8AB
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.