Menu

Base58 Encode & Decode

What is Base58?

Base58 is a binary-to-text encoding scheme designed for representing large integers as alphanumeric strings. It's similar to Base64 but uses a smaller alphabet of 58 characters, excluding visually ambiguous characters like 0 (zero), O (capital o), I (capital i), and l (lowercase L), as well as non-alphanumeric characters + and /.

The standard Base58 alphabet is: 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz

How It Works

Encoding: Treats the input binary data as a large base-256 number. This number is then repeatedly divided by 58, and the remainders map to the Base58 characters. Leading zero bytes in the input result in leading '1' characters (the Base58 character for zero) in the output to preserve them.

Decoding: Converts the Base58 string back into the large integer it represents. This integer is then converted back into a sequence of bytes. Leading '1' characters are converted back to leading zero bytes.

  • Uses 58 characters (1-9, A-H, J-N, P-Z, a-k, m-z).
  • Excludes visually confusing characters (0, O, I, l).
  • Case-sensitive.
  • No padding characters are used.
  • Variable length encoding; the length depends on the magnitude of the number being represented.
  • Includes Base58Check variant (not implemented here) which adds a checksum for error detection.

Use Cases

Base58 is primarily known for its use in cryptocurrencies:

  • Bitcoin Addresses: Wallet addresses (like `1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2`) use Base58Check.
  • Other Cryptocurrencies: Many other blockchains (e.g., Ripple, IPFS content hashes) use Base58 or Base58Check for addresses, keys, or identifiers.
  • Short URLs: Flickr used Base58 for its photo URLs.
  • Compact Identifiers: Generating relatively short, unambiguous alphanumeric IDs.

Why is Base58 Used?

Its specific character set makes it suitable for human interaction:

  • Reduced Ambiguity: Excluding similar-looking characters minimizes errors when reading or manually typing Base58 strings (important for crypto addresses).
  • Double-Click Selection: The alphabet avoids non-alphanumeric characters, making it easier to select the entire string with a double-click in most text editors.
  • Compactness: Offers reasonable compactness compared to Hex, though less dense than Base64.

How to Use This Tool

  1. Select either "Encode" or "Decode" mode.
  2. Enter the text (for encoding) or Base58 string (for decoding) into the top input field.
  3. The result will appear automatically in the bottom output field.
  4. Use the swap button () to switch the input and output, automatically changing the mode.
  5. Click the copy icon () next to the output label to copy the result.
  6. Error messages will appear for invalid input (e.g., characters outside the Base58 alphabet) or conversion issues.