How to encode to Base58
- Type or paste text into Input · Text. The Base58 string appears in Output · Base58 as you type.
- Choose the Alphabet under the output: Bitcoin (the default, also used by IPFS and Solana), Flickr or Ripple.
- To encode raw bytes instead of text, set From to Hex or Base64 and paste the bytes in that form. A public key or hash is almost always bytes, not text.
- Click Base58 → Text in the direction toggle to decode, or open the Base58 decoder, which shows the bytes as hex.
How Base58 encoding works
Base58 does not cut the input into fixed bit groups the way Base64 does. It reads all the bytes as one big-endian number and writes that number in base 58, then adds one 1 for every leading zero byte. That is why a single changed byte can change the whole string, and why the length depends on the value and not only on the byte count.
The cost of treating the data as one number grows quickly with size, so this tool caps Base58 input at 64 KB. That is far more than any key, hash or address needs.
The three Base58 alphabets
All three use the same 58 characters (digits and letters without 0, O, I, l), in a different order:
| Alphabet | Starts with | Hello | 0x00 0x00 0x01 |
|---|---|---|---|
| Bitcoin | 123456789ABC… | 9Ajdvzr | 112 |
| Flickr | 123456789abc… | 9aJCVZR | 112 |
| Ripple | rpshnaf39wBU… | 9wjdvzi | rrp |
Flickr swaps upper and lower case, which Flickr used for short photo URLs. Ripple’s alphabet starts with r, so XRP Ledger addresses, which have a zero version byte, start with r the way Bitcoin addresses start with 1. Decoding with the wrong alphabet usually works without an error and gives different bytes, so check the alphabet first when a value does not match.
Leading zeros and the 1 prefix
Because Base58 treats data as a number, zero bytes at the front would vanish. The format keeps them by writing one 1 per zero byte:
| Bytes (hex) | Base58 |
|---|---|
00 | 1 |
00 00 | 11 |
00 01 | 12 |
ff | 5Q |
31 × 00, then ff | 11111111111111111111111111111115Q |
32 × 00 | 11111111111111111111111111111111 |
The last row is a real address: thirty-two 1s is the Solana System Program, whose public key is 32 zero bytes. Leading zeros are where hand-written Base58 code most often goes wrong, and an encoder that drops them produces strings that decode to fewer bytes.
Where Base58 is used
- Bitcoin addresses and WIF keys. Legacy addresses (
1…,3…) and WIF private keys (5…,K…,L…) are Base58Check: Base58 with a version byte and a checksum. Bech32 addresses (bc1…) are a different encoding. - IPFS CIDv0. The
Qm…identifiers are plain Base58 of a 34-byte multihash:12(SHA-256),20(32 bytes long) and the digest. The12 20header is what makes every CIDv0 start withQm. - Solana. Addresses and public keys are Base58 of 32 bytes (32 to 44 characters); transaction signatures are Base58 of 64 bytes (up to 88 characters).
Base58 in Python
Python has no Base58 in the standard library. The algorithm is short enough to write out, and this version handles leading zeros:
ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
def b58encode(data: bytes) -> str:
n = int.from_bytes(data, "big")
out = ""
while n:
n, r = divmod(n, 58)
out = ALPHABET[r] + out
zeros = len(data) - len(data.lstrip(b"\0"))
return "1" * zeros + out
b58encode(b"Hello") # '9Ajdvzr'
b58encode(bytes(32)) # '11111111111111111111111111111111'
For production code, a maintained package such as base58 on PyPI also covers Base58Check. General Python encoding patterns are on the Python page.
FAQ
Which characters does Base58 leave out?
Base58 is Base62 minus four look-alikes: 0 (zero), O (capital o), I (capital i) and l (lower-case L). It also has no +, / or =, so a Base58 string can be double-clicked as one word and used in a URL without escaping.
Why does Base58 output start with 1?
Each 1 stands for one leading zero byte of the input. A plain number would lose those zeros, so Base58 writes them out explicitly. Bitcoin addresses start with 1 because their version byte is 0x00.
Is Base58 the same as Base58Check?
No. Base58Check is Base58 applied to a payload with a 4-byte double SHA-256 checksum appended. Bitcoin addresses and WIF private keys use it; Solana addresses and IPFS CIDv0 use plain Base58. Use the Base58Check tool for the checksummed form.
How much longer is Base58 than the input?
About 37% for random data (log 256 / log 58 ≈ 1.366), slightly more than Base64’s 33%. The exact length depends on the value: 32 random bytes give 43 or 44 characters, while 32 zero bytes give 32 ones.