Base58 decode with the right alphabet
To Base58 decode a string, each character is looked up in the alphabet, the digits are combined into one big number in base 58, and that number is written out as bytes. The alphabet matters: the same string decodes to different bytes under the Bitcoin, Flickr and Ripple orderings. Pick the one that matches the source of your data.
The three Base58 alphabets compared
All three alphabets use the same 58 characters, just in a different order, which is why a string can be valid in every alphabet and still decode to different bytes.
| Alphabet | Character for zero | Where you meet it |
|---|---|---|
| Bitcoin | 1 | Bitcoin legacy addresses, IPFS CIDv0 hashes, Solana keys and most libraries' default |
| Flickr | 1 | Flickr short links (flic.kr); lowercase letters come before uppercase |
| Ripple | r | XRP Ledger addresses, which is why they start with r |
A quick way to pick the alphabet: if the value starts with r and comes from an XRP wallet, choose Ripple; if it is a Qm… hash or a Bitcoin-style address, keep Bitcoin; Flickr is only needed for photo short links.
Example
Base58 input (Bitcoin alphabet):
2NEpo7TZRRrLZSi2UDecoded text:
Hello World!
What you can decode — and what to expect
- Text encoded with Base58 decodes to readable characters, as in the example.
- Hashes and keys such as IPFS CIDv0 values (
Qm…) or public keys decode to raw binary bytes. The text view will show unreadable characters or�; that is normal because the data is not text. - Cryptocurrency addresses decode to a version byte, a hash and a 4-byte Base58Check checksum. This tool shows the raw bytes but does not verify the checksum.
Common errors
- “Input is not valid Base58 for the selected alphabet”. The string contains
0,O,I,l, a space inside the value, or punctuation. Check for copy-paste mistakes or a different encoding. - It is really Base64. Strings with
+,/or trailing=are Base64 — use the Base64 Decoder. - Wrong alphabet. If the output is garbled but no error appears, try the other alphabets. A Ripple address decoded with the Bitcoin alphabet will not produce sensible bytes.
Leading 1s and zero bytes
In the Bitcoin alphabet, 1 stands for the value zero. Every leading 1 in a Base58 string decodes to a leading 00 byte, which is why legacy Bitcoin addresses starting with 1 have a version byte of zero. Keep this in mind when comparing decoded bytes: removing a leading 1 changes the data.
Privacy
Decoding happens entirely in your browser. Still, never paste a private key or wallet recovery secret into any website: anyone with it can control the funds. Addresses and public hashes are fine to inspect.
To inspect decoded binary data as hex, copy the output into String to Hex, or encode new text with Base58 Encode.
Base58 decode in Python
Python's base64 module covers Base16, Base32, Base64 and Base85 but not Base58, so decode it with a few lines of integer arithmetic: read the string as a base-58 number, then convert it to bytes with int.to_bytes(). The step that is easy to forget is the leading zeros. Each leading 1 stands for a zero byte that the integer conversion drops, so count them and add the bytes back. Pass a different alphabet string for Flickr or Ripple data.
ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
def b58decode(value, alphabet=ALPHABET):
number = 0
for char in value:
number = number * 58 + alphabet.index(char)
body = number.to_bytes((number.bit_length() + 7) // 8, "big")
zeros = len(value) - len(value.lstrip(alphabet[0]))
return b"\x00" * zeros + body
print(b58decode("2NEpo7TZRRrLZSi2U").decode("utf-8"))
print(b58decode("11233QC4").hex())
The first line prints the same text as the decoder above for its sample; the second shows two leading zero bytes restored in front of the data.