How to convert Base58 to Base64
- Paste the Base58 string into Input · Base58. Line breaks and spaces are ignored.
- If it does not use the Bitcoin alphabet, change Alphabet under the input to Flickr or Ripple.
- Read the Base64 in Output · Base64. Under the output, untick Padding (=) for unpadded Base64, or set Line wrap to 64 or 76 columns.
- Copy output, or use Base64 → Base58 in the direction toggle for the reverse; the Base64 to Base58 page starts there.
The counters below the tool show the input length, the number of decoded Bytes and the output length. The byte count is the quickest check that you pasted a whole key: 32 for a Solana public key, 64 for a signature or a keypair, 34 for an IPFS CIDv0.
Examples
| Base58 | Base64 | Bytes |
|---|---|---|
9Ajdvzr | SGVsbG8= | 5, the text Hello |
11111111111111111111111111111111 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= | 32 zero bytes |
TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA | Bt324ddloZPZy+FGzut5rBy0he1fWzeROoz1hX7/AKk= | 32, Solana SPL Token program |
QmQudp5N7EzTxrBk3yESEKyEroMYNd7R22G2KWffwNZyzq | EiAmKoa2duWGnt1dGt+P/QHWKcMVS/3q7PyM+g2Q4Igtig== | 34, IPFS CIDv0 |
1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa | AGLpB7FcvyfVQlOZ6/bw+1DruI8Ywpt9kw== | 25, Bitcoin address with checksum |
Every CIDv0 converts to Base64 starting with EiA: that is the multihash header 12 20 (SHA-256, 32 bytes). Remove the first two bytes and you have the bare digest, the form a SHA-256 tool prints.
Why Solana data turns up in both encodings
Solana shows public keys, program IDs and transaction signatures in Base58 in wallets and explorers. Its JSON-RPC API, on the other hand, accepts serialized transactions as Base64 or Base58 and marks Base58 as the slow, deprecated choice. Account data comes back as Base64 when you request that encoding. So the same 32-byte key can appear as Base58 in one place and inside Base64 in another.
Converting does not change the bytes, which makes it a safe way to compare two values: if a Base58 key and a Base64 key give the same Base64 here, they are the same key.
Base58 to Base64 in Python
The standard library has Base64 but no Base58, so the first half is a short loop:
import base64
ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
def base58_to_base64(s: str) -> str:
n = 0
for ch in s:
n = n * 58 + ALPHABET.index(ch)
body = n.to_bytes((n.bit_length() + 7) // 8, "big")
zeros = len(s) - len(s.lstrip("1"))
return base64.b64encode(b"\0" * zeros + body).decode()
base58_to_base64("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")
# 'Bt324ddloZPZy+FGzut5rBy0he1fWzeROoz1hX7/AKk='
ALPHABET.index raises ValueError on characters outside Base58, such as 0 or l. More Base64 handling in Python is on the Python page.
Common problems
- The byte count is one short. The converter you used before dropped a leading zero byte. This page keeps them; compare the outputs.
- Error at a
0,O,Iorl. Those characters are not Base58. Check for a copy or OCR mistake. - The input starts with
bc1,0xorbafy. These are Bech32, hex and Base32 (IPFS CIDv1) respectively, not Base58. For a CIDv1, the Base32 decoder explains how to read it. - The output is 4 bytes longer than expected. The string was Base58Check, and the checksum is still attached.
FAQ
How do I convert a Solana public key to Base64?
Paste the address into the input. A valid Solana public key decodes to exactly 32 bytes, so the Base64 output is always 44 characters ending in one =, or 43 without padding.
Why does the Base64 start with A?
The Base58 input started with 1, which decodes to a zero byte. Base64 takes its first character from the first 6 bits, and six zero bits are A. That is why the Bitcoin address 1A1zP1… becomes AGLp….
How do I get URL-safe Base64 instead?
Copy the result into Base64 to Base64URL, which swaps + and / for - and _ and removes the padding. Untick Padding (=) here if you only need to drop the =.
Is the output different for Base58Check strings?
The conversion is the same, but the Base64 then includes the version byte and the 4-byte checksum. Decode with the Base58Check tool first if you only want the payload.