How to use the base45 encoder and decoder
- Choose Encode or Decode.
- When encoding, choose whether your input is text or hex bytes.
- Paste the input.
- Copy the result, which for decoding is shown as text, or as hex if the bytes are not valid UTF-8.
Formula
Two bytes a and b make n = 256 x a + b
n is written as three characters c, d and e with n = c + 45 x d + 45 x 45 x e, least significant first
A last single byte is written as two characters
The alphabet is 0 to 9, A to Z, space and $ % * + - . / :
Base45 is defined in RFC 9285. It is not a way to hide data.
The test values from the standard
The two bytes AB encode to BB8, because 65 x 256 + 66 = 16706, which is 11 + 45 x 11 + 2025 x 8, and those digits are the characters B, B and 8. The text Hello!! is 7 bytes and encodes to %69 VD92EX0, 11 characters, and base-45 encodes to UJCLQE7W581.
Decoding QED8WEX0 gives ietf!. A group such as GGW decodes to a number larger than 65,535, and the tool says so, and a length that is one more than a multiple of 3 is refused.
Why Base45 exists
QR codes have a mode for alphanumeric text that stores more characters in the same space than the byte mode. Its alphabet has 45 symbols, and Base45 packs bytes into them so that binary data fits the denser mode. Health certificates and other documents scanned from QR codes often use it. The result is about 50% larger than the data.
Unlike Base64, the alphabet includes a space and symbols that need care in a URL. Put Base45 text in a QR code as it is, not in a web address.
Related tools
Base45 does not compress or protect anything. It only changes the form of the data. For other encodings see the Base64 Encoder and Decoder and the Base32 Encoder and Decoder, to draw the result as a code the QR Code Generator, and to look at the bytes the Hex Viewer.
Assumptions and limits
- Text is converted to bytes as UTF-8.
- Hex input may contain spaces, commas and 0x prefixes, and needs an even number of digits.
- The text shown is an example. Use your own data.
- Everything runs in your browser and nothing is uploaded.
Frequently asked questions
Why does a group fail to decode?
Three characters can hold numbers up to 91,124, but two bytes reach only 65,535. A larger value cannot be real data.
Is the output case sensitive?
Yes. The alphabet has capital letters only, so lowercase letters are rejected when decoding.
What if the decoded bytes are not text?
The tool shows them as hex bytes and says they are not valid UTF-8, instead of showing broken characters.
Can I decode several lines?
Put the whole string on one line. A final line break is ignored, but a break in the middle is not part of the alphabet.