Utility Coder
← Back to Blog
Encoding10 min read

Base58 Encoding: The Cryptocurrency Standard Explained

Learn Base58 encoding used in Bitcoin and blockchain. Understand Base58Check, implementation details, and why cryptocurrencies chose this encoding scheme.

By Andy Pham

Base58 Encoding: The Cryptocurrency Standard Explained

Base58 encoding is a binary-to-text encoding scheme designed specifically to improve human readability while maintaining compact representation. Created for Bitcoin, it has become the de facto standard for cryptocurrency addresses.

What is Base58 Encoding?

Base58 uses 58 alphanumeric characters, deliberately excluding:

  • 0 (zero) - confused with O
  • O (uppercase O) - confused with 0
  • l (lowercase L) - confused with 1 and I
  • I (uppercase I) - confused with l and 1
    • and / - not URL-safe

The Base58 Alphabet (Bitcoin Standard)

123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz

Why Was Base58 Created?

Satoshi Nakamoto created Base58 for Bitcoin to solve real-world problems:

1. Human Transcription

When users manually type addresses, similar-looking characters cause errors. Base58 eliminates this ambiguity.

2. Double-Click Selection

Base58 addresses don't contain special characters, making them fully selectable with a double-click.

3. Compact Representation

More space-efficient than hexadecimal:

  • Hex: 40 characters for 160 bits
  • Base58: 34 characters for 160 bits

Base58 vs Other Encodings

Feature Base58 Base64 Base32 Hex
Characters 58 64 32 16
Size Efficiency ~73% ~75% ~63% 50%
Human Readable Excellent Poor Good Medium
Ambiguous Chars None Many Few Some

How Base58 Encoding Works

Unlike Base64 which works with fixed bit groups, Base58 treats input as a large number and performs repeated division.

JavaScript Implementation

function base58Encode(bytes) {
  const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';

  let leadingZeros = 0;
  for (let i = 0; i < bytes.length && bytes[i] === 0; i++) {
    leadingZeros++;
  }

  let num = BigInt(0);
  for (let byte of bytes) {
    num = num * BigInt(256) + BigInt(byte);
  }

  let result = '';
  while (num > 0) {
    result = ALPHABET[Number(num % BigInt(58))] + result;
    num = num / BigInt(58);
  }

  return '1'.repeat(leadingZeros) + result;
}

Base58Check: Adding Checksum Validation

Bitcoin uses Base58Check, which adds a 4-byte checksum for error detection:

Base58Check = Base58(Version + Payload + Checksum)

Where:
- Version: 1 byte (0x00 for mainnet addresses)
- Payload: The actual data
- Checksum: First 4 bytes of SHA256(SHA256(Version + Payload))

Bitcoin Address Structure

Step 1: Generate public key from private key
Step 2: SHA256(public key)
Step 3: RIPEMD160(Step 2) = 20 bytes
Step 4: Add version byte (0x00 for mainnet)
Step 5: Base58Check encode

Example Address: 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa

Common Use Cases

1. Cryptocurrency Addresses

Bitcoin (P2PKH):  1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2
Bitcoin (P2SH):   3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy
Litecoin:         LaMT348PWRnrqeeWArpwQPbuanpXDZGEUz

2. IPFS Content Identifiers

QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG

3. Decentralized Identifiers

did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK

Best Practices

  • Always use Base58Check for critical data (adds error detection)
  • Validate addresses before sending transactions
  • Use established libraries in production code
  • Handle leading zeros correctly (they matter!)

Try Our Base58 Tools

Conclusion

Base58 encoding offers an excellent balance of space efficiency and human usability. Its deliberate exclusion of ambiguous characters and built-in checksum variant make it ideal for financial and security-critical applications.

Share this article