Utility Coder
Back to Blog
encoding

BASE58 Encode

Andy Pham
base58 encode, base58 encode, base58 encode online

Ready to try BASE58 Encode?

Access the free online tool now - no registration required

Open Tool

BASE58 Encode - Complete Guide

Base58 encoding represents binary data using 58 alphanumeric characters, excluding easily confused characters (0, O, I, l). Created for Bitcoin addresses, it's ideal for user-facing identifiers that need to be typed accurately without visual ambiguity.

How It Works

Base58 treats input bytes as a big integer, then repeatedly divides by 58, mapping remainders to characters. Unlike Base64/32, it's not bit-aligned but produces shorter, unambiguous output. Leading zeros become '1' characters.

Technical Details

Base58 alphabet: 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz (excludes 0, O, I, l). No padding needed. ~37% space overhead. Variants: Base58Check adds 4-byte checksum for error detection.

Common Use Cases

  1. Cryptocurrency Addresses: Bitcoin, Litecoin, and many cryptocurrencies use Base58Check.
    • Example: 1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2
  2. Short URLs: URL shorteners use Base58 for compact, unambiguous IDs.
  3. File Identifiers: IPFS CIDv0 uses Base58btc encoding.
  4. User-Facing Codes: Any identifier users might type manually.

Code Examples

Base58 Encoding

const BASE58_CHARS = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';

function base58Encode(bytes) {
  // Handle leading zeros
  let zeros = 0;
  for (const b of bytes) {
    if (b === 0) zeros++;
    else break;
  }

  // Convert bytes to big integer
  let num = BigInt(0);
  for (const byte of bytes) {
    num = num * 256n + BigInt(byte);
  }

  // Convert to base58
  let result = '';
  while (num > 0n) {
    result = BASE58_CHARS[Number(num % 58n)] + result;
    num = num / 58n;
  }

  // Add leading '1's for leading zeros
  return '1'.repeat(zeros) + result;
}

// Example: encode "Hello"
const bytes = new TextEncoder().encode('Hello');
base58Encode(bytes);  // "9Ajdvzr"

Treat input as big integer, convert to base 58, preserve leading zeros as "1"s.

Tips & Best Practices

  • Use for user-facing identifiers
  • Case-sensitive - handle carefully
  • Add checksum (Base58Check) for critical data
  • Leading zeros become "1" characters
  • Not bit-aligned like Base64/32

Common Mistakes to Avoid

  • Treating as case-insensitive
  • Not preserving leading zeros
  • Using without checksum for addresses
  • Confusing with Base64 (different output)

When to Use This Tool

Use Base58 for cryptocurrency addresses, short URLs, and any user-facing identifier where visual clarity matters. Add checksum for critical data that users type.

Frequently Asked Questions

Why not use Base64?

Base64 includes +, /, = which cause URL encoding issues and visual confusion. Base58 is URL-safe by default and excludes 0/O/I/l which look similar in many fonts. Trade-off: Base58 is larger (37% vs 33% overhead).

What is Base58Check?

Base58Check appends a 4-byte checksum (double SHA-256) before encoding. This detects typos in addresses. A single wrong character makes the checksum fail, preventing funds sent to invalid addresses.

Why do Bitcoin addresses start with 1 or 3?

The first byte (version byte) determines the prefix after encoding. Version 0x00 produces "1", 0x05 produces "3". This indicates address type (P2PKH vs P2SH) visually.

Is Base58 case-sensitive?

Yes! Unlike Base32, Base58 is case-sensitive. "A" and "a" are different characters. This doubles the alphabet size but requires careful handling in user input.

Get Started

Ready to try BASE58 Encode? Use the tool now - it's free, fast, and works right in your browser.


Last updated: June 27, 2026

Start using BASE58 Encode

Free, fast, and privacy-focused - try it now

Launch Tool