Base45 to Base64 Converter
Convert between Base45 (RFC 9285) and Base64 encodings instantly. Decode Base45 to binary, re-encode as Base64, or reverse the process.
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.
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 + b1c0 = 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 ร 452b0 = (n รท 256) mod 256
b1 = n mod 256
Single trailing byte [b0] encodes to 2 characters:
c0 = b0 mod 45c1 = (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
| Property | Base45 (RFC 9285) | Base64 (RFC 4648) |
|---|---|---|
| Alphabet Size | 45 characters | 64 characters + pad |
| Character Set | 0-9 A - Z SPACE $ % * + - . / : | A - Z a - z 0-9 + / |
| Padding Character | None | = |
| Encoding Ratio | 2 bytes โ 3 chars (1.5ร) | 3 bytes โ 4 chars (1.33ร) |
| Efficiency | 66.7% | 75% |
| QR Alphanumeric Mode | Fully compatible | Requires binary mode |
| Case Sensitivity | Uppercase only | Case-sensitive |
| Specification | RFC 9285 (2022) | RFC 4648 (2006) |
| Primary Use Case | QR codes, health certificates | Email, data URIs, web APIs |
| Whitespace Handling | Space (0x20) is valid char (index 36) | Whitespace ignored by liberal parsers |
| Chunk Input Size | 2 bytes (last chunk: 1 byte) | 3 bytes (padded) |
| Chunk Output Size | 3 chars (last chunk: 2 chars) | 4 chars (with = padding) |
| Max Value per Chunk | 2-byte chunk: 453 โ 1 = 91124 (> 65535) | N/A (bit-packing) |
| 1-byte Chunk Max | 452 โ 1 = 2024 (> 255) | N/A |
| URL Safe Variant | Not defined | RFC 4648 ยง5 (- _ replace + /) |
| Error Detection | Invalid chars or overflow | Invalid chars or bad padding |
| Sorting Preservation | No | Yes (lexicographic) |
| Compression Friendly | Often wraps ZLIB+CBOR | Not inherently |