Skip to content

↑↓ navigate ↵ open Esc close Search runs locally

Base58 Encode & Decode Online

Encode text to Base58 and decode Base58 back, with the Bitcoin, Flickr and Ripple alphabets. The format behind Bitcoin addresses, Solana keys and IPFS hashes.

  • Runs in your browser
  • Nothing is uploaded
  • Free, no sign-up
0 BUTF-8
Base58
Runs in your browser. Nothing is uploaded. Tip: drop a file onto the left box

How to use the Base58 tool#

  1. Choose Encode to turn text into Base58, or Decode to turn Base58 back into text or bytes.
  2. Pick the Alphabet: Bitcoin (also used by IPFS, Solana and most libraries), Flickr or Ripple.
  3. Type or paste into the left box. The result updates as you type.
  4. Copy or download the result. Binary results, such as decoded addresses, can be downloaded as a file.

Examples#

Encode a short sentence

Input
Hello World!
Output
2NEpo7TZRRrLZSi2U

A test vector from the Base58 specification draft. 12 bytes become 17 characters.

Decode a longer value

Input
USm3fpXnKG5EUBx2ndxBDMPVciP5hGey2Jh4NDv6gmeo1LkMeiKrLJUUBk6Z
Output
The quick brown fox jumps over the lazy dog.

Another official test vector. There are no 0, O, I or l characters anywhere in it.

Encode a single character

Input
a
Output
2g

a is byte 97. 97 = 1 × 58 + 39, and the digits 1 and 39 are 2 and g in the Bitcoin alphabet.

What is Base58?#

Base58 writes binary data using 58 characters: the digits and letters, minus four that are easy to confuse. It leaves out 0 (zero), O (capital o), I (capital i) and l (lowercase L), and it has no +, / or =. The result is a compact string that people can read and copy without mistakes, and that selects as one word when you double-click it.

Base58 was introduced by Bitcoin for addresses and keys. Today it is also used by IPFS, Solana, Monero (with its own block format) and many systems that need short, unambiguous IDs.

The Base58 alphabets#

AlphabetCharacters (value 0 → 57)Used by
Bitcoin123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyzBitcoin, IPFS, Solana, most libraries
Flickr123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZFlickr short photo URLs
Ripplerpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyzXRP Ledger addresses

The same bytes give a different string in each alphabet, so a value encoded with one alphabet must be decoded with the same one.

How Base58 works#

58 is not a power of 2, so Base58 cannot split the input into fixed groups of bits the way Base64 or Base32 do. Instead, it treats the whole input as one big number and converts that number to base 58, exactly like converting a decimal number to another base by repeated division.

  1. Read the bytes as one big-endian number. a is the number 97.
  2. Divide by 58 repeatedly and keep the remainders: 97 ÷ 58 = 1, remainder 39.
  3. Write the remainders from last to first as alphabet characters: 1 → 2, 39 → g, so a becomes 2g.
  4. Write one 1 for every leading zero byte of the input, because those zeros would otherwise disappear from the number.

The leading-zero rule matters. The bytes 00 00 28 7f b4 cd encode to 11233QC4: the two 1s stand for the two zero bytes. Bitcoin addresses that start with 1 get it this way, from a version byte of 0.

Size and speed#

Each Base58 character carries about 5.86 bits, so the output is about 37% larger than the input, slightly more than Base64. Because the whole input is one number, encoding gets slower as the data grows (the work grows with the square of the length). That is fine for keys, hashes and addresses, but Base58 is a poor fit for files. This tool limits Base58 to 64 KB; use Base64 for anything larger.

Base58 vs Base58Check#

Bitcoin addresses and WIF private keys use Base58Check, which adds structure before encoding:

plaintext
Base58( version byte + payload + first 4 bytes of SHA256(SHA256(version + payload)) )

The 4-byte checksum lets wallets reject a mistyped address. This tool does plain Base58: decoding an address shows the raw version byte, payload and checksum bytes (as binary), but it does not verify the checksum. Newer Bitcoin addresses (bc1…) use Bech32, which is a different encoding.

Where Base58 is used#

  • Bitcoin: legacy (1…) and P2SH (3…) addresses, WIF private keys and extended keys (xpub…), all in Base58Check.
  • IPFS: CIDv0 content IDs (Qm…) are Base58 multihashes. CIDv1 usually uses Base32 instead.
  • Solana: public keys, addresses and transaction signatures.
  • Short IDs: anywhere an ID must be readable and copyable without lookalike characters.

Base58 in code#

JavaScript (bs58 package)#

javascript
import bs58 from 'bs58'; const encoded = bs58.encode(new TextEncoder().encode('Hello World!')); // "2NEpo7TZRRrLZSi2U"const bytes = bs58.decode(encoded);

Python (base58 package)#

python
import base58 base58.b58encode(b'Hello World!')        # b'2NEpo7TZRRrLZSi2U'base58.b58decode('2NEpo7TZRRrLZSi2U')    # b'Hello World!' # Base58Check (adds and verifies the 4-byte checksum)base58.b58encode_check(b'\x00' + payload)

A minimal encoder (any language)#

javascript
const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; function base58Encode(bytes) {  let n = 0n;  for (const b of bytes) n = n * 256n + BigInt(b);  let out = '';  while (n > 0n) { out = ALPHABET[Number(n % 58n)] + out; n /= 58n; }  for (const b of bytes) { if (b !== 0) break; out = '1' + out; } // leading zero bytes  return out;}

Common errors and fixes#

  • "Invalid character" for 0, O, I or l

    Those four characters do not exist in Base58. The value was mistyped (for example O instead of o), or it is not Base58 at all. Check the source, because guessing a replacement character changes the decoded bytes.

  • The result is different from another tool or library

    The two sides use different alphabets (Bitcoin, Flickr or Ripple). Switch the Alphabet option. Also check whether the other tool uses Base58Check, which adds a version byte and checksum.

  • Leading 1 characters disappear, or zero bytes are lost

    Code that converts Base58 to an integer and back drops leading zeros. A correct encoder writes one 1 per leading zero byte, and a decoder turns each leading 1 back into a zero byte.

  • A decoded Bitcoin address shows "Binary data"

    That is expected. An address decodes to a version byte, a 20-byte hash and a 4-byte checksum, not to text. Download the bytes, or use the Hex tool to read them.

  • "Invalid checksum" in a wallet or library

    The value uses Base58Check and one character is wrong. The checksum is doing its job: get the address again from its source instead of trying to fix it by hand.

Frequently asked questions#

Why does Base58 leave out 0, O, I and l?

They look alike in many fonts (0/O and I/l). Removing them makes addresses and keys much harder to misread or mistype, which matters when money is involved.

Is Base58 the same as Base64?

No. Base64 splits data into 6-bit groups and uses +, / and =. Base58 converts the whole input as one large number, has no special characters and skips lookalike letters. It is slightly larger and much slower on big data.

Can this tool validate a Bitcoin address?

No. It does plain Base58 and does not verify the Base58Check checksum or the address version. Use a wallet or a dedicated address validator for that.

Why is there a size limit for Base58?

Base58 treats the input as one big number, so the work grows with the square of the length. Keys, hashes and IDs are tiny, so the 64 KB limit never gets in the way of normal use.

Which alphabet should I use?

Use the Bitcoin alphabet unless you know otherwise. It is the default in nearly every library and is used by Bitcoin, IPFS and Solana. Ripple and Flickr have their own.

Is it safe to paste a private key here?

Everything runs in your browser and nothing is uploaded. Still, a private key is the money itself, so avoid pasting real keys into any website when you can.

Your next tool is one search away.

Free, private developer tools that run in your browser. No signup, nothing uploaded, no waiting.

Browse all tools

Tip: press Ctrl D to bookmark dev247.