User Rating 0.0 โ˜…โ˜…โ˜…โ˜…โ˜…
Total Usage 0 times
0 chars
Base45 โ†’ Base64
0 chars
Examples:
Is this tool helpful?

Your feedback helps us improve.

โ˜… โ˜… โ˜… โ˜… โ˜…

About

Base45 encoding (defined in RFC 9285) was designed for QR-code-optimized data transport, notably used in EU Digital COVID Certificates. It encodes arbitrary binary data using 45 characters from the alphanumeric QR code subset, achieving roughly 2 input bytes per 3 output characters. Base64, by contrast, uses 64 characters and encodes 3 input bytes into 4 output characters. Converting between these two formats requires an intermediate binary step: decode one encoding to its raw byte sequence, then re-encode into the target format. Mishandling the alphabet mapping or chunk boundaries produces corrupted output with no obvious error indicator. This tool performs the full decode - re-encode pipeline with strict validation against both alphabets.

Limitations: this converter operates on the raw encoded payload. It does not interpret compressed content (e.g., ZLIB-wrapped CBOR inside health certificates). If your Base45 payload contains compressed data, the Base64 output represents those compressed bytes, not the decompressed content. Pro tip: validate your Base45 input length. A valid Base45 string has length L where L mod 3 must equal 0 or 2. A remainder of 1 signals a malformed input.

base45 base64 encoding decoding RFC 9285 converter binary data encoding

Formulas

Base45 encoding maps groups of bytes to characters using base-45 positional notation. The alphabet A is indexed 0 - 44.

Encoding 2 bytes [b0, b1] to 3 characters:

n = b0 ร— 256 + b1
c0 = n mod 45
c1 = (n รท 45) mod 45
c2 = (n รท 452) mod 45

Decoding 3 characters [c0, c1, c2] back to 2 bytes:

n = c0 + c1 ร— 45 + c2 ร— 452
b0 = (n รท 256) mod 256
b1 = n mod 256

Single trailing byte [b0] encodes to 2 characters:

c0 = b0 mod 45
c1 = (b0 รท 45) mod 45

where bi = byte value (0 - 255), ci = index into the Base45 alphabet, n = intermediate integer, and รท denotes integer (floor) division. Overflow check: for a 3-character group, n must satisfy n โ‰ค 65535 (0xFFFF). For Base64, the standard 6-bit packing is used via native btoa/atob with a Uint8Array binary bridge.

Reference Data

PropertyBase45 (RFC 9285)Base64 (RFC 4648)
Alphabet Size45 characters64 characters + pad
Character Set0-9 A - Z SPACE $ % * + - . / :A - Z a - z 0-9 + /
Padding CharacterNone=
Encoding Ratio2 bytes โ†’ 3 chars (1.5ร—)3 bytes โ†’ 4 chars (1.33ร—)
Efficiency66.7%75%
QR Alphanumeric ModeFully compatibleRequires binary mode
Case SensitivityUppercase onlyCase-sensitive
SpecificationRFC 9285 (2022)RFC 4648 (2006)
Primary Use CaseQR codes, health certificatesEmail, data URIs, web APIs
Whitespace HandlingSpace (0x20) is valid char (index 36)Whitespace ignored by liberal parsers
Chunk Input Size2 bytes (last chunk: 1 byte)3 bytes (padded)
Chunk Output Size3 chars (last chunk: 2 chars)4 chars (with = padding)
Max Value per Chunk2-byte chunk: 453 โˆ’ 1 = 91124 (> 65535)N/A (bit-packing)
1-byte Chunk Max452 โˆ’ 1 = 2024 (> 255)N/A
URL Safe VariantNot definedRFC 4648 ยง5 (- _ replace + /)
Error DetectionInvalid chars or overflowInvalid chars or bad padding
Sorting PreservationNoYes (lexicographic)
Compression FriendlyOften wraps ZLIB+CBORNot inherently

Frequently Asked Questions

A 3-character Base45 group decodes to an integer n = c0 + c1 ร— 45 + c2 ร— 452. This value must fit in 2 bytes, meaning n โ‰ค 65535. If the three characters produce a value exceeding this limit, the input is malformed. Check for corrupted or truncated data.
Yes. The converter treats the payload as opaque binary data. It decodes Base64 to raw bytes using atob, then re-encodes those exact bytes into Base45. No interpretation of the content occurs. Compressed payloads (ZLIB, gzip) remain compressed in the output.
Base45 has lower encoding efficiency. It uses 3 characters per 2 bytes (expansion factor 1.5ร—), while Base64 uses 4 characters per 3 bytes (factor 1.33ร—). The tradeoff is QR code compatibility: Base45 characters all belong to the QR alphanumeric subset, yielding smaller QR codes despite longer strings.
The space character (ASCII 0x20) is the 37th character in the Base45 alphabet (index 36). It is a valid encoding character, not whitespace to be trimmed. The converter preserves spaces within the input. Leading and trailing spaces are also treated as valid Base45 data.
A valid Base45 string length L satisfies L mod 3 โˆˆ {0, 2}. A remainder of 1 is structurally impossible under RFC 9285 because a single character cannot represent any valid byte group. The converter rejects such inputs with a specific error message.
Yes. The converter auto-detects Base64url input by checking for - and _ characters (which replace + and / per RFC 4648 ยง5). It normalizes them to standard Base64 before decoding. Output is always standard Base64 with + and /.