Encodings

Base58

Binary-to-text encodings: hex, Base32, Base58, Base64, Base85 and relatives

standard Safe API Not cryptographic

About Base58

Base58 is one of 25 Base-N encodings variants in the NextSSL registry, a binary-to-text encoding. Its registry entry cites Bitcoin base58 (draft-msporny-base58). NextSSL lists it in the standard tier and exposes it through the safe API.

Overview

Base-N encodings represent arbitrary binary data using a restricted alphabet of printable characters so it can travel through text-only channels such as email, URLs, JSON or DNS. They are reversible transformations, not encryption, and provide no security or confidentiality.

An encoding groups input bits and maps each group to a symbol. Base16 (hex) maps 4 bits to one of 16 characters. Base32 maps 5 bits, and Base64 maps 6 bits, with '=' padding to complete the last group. Base85 and Ascii85 map 4 bytes to 5 characters for denser output. Base58, used for Bitcoin addresses, treats the whole input as a big integer and removes visually ambiguous characters such as 0, O, I and l; Base58Check adds a SHA-256-based checksum.

NextSSL includes over twenty variants: hex/Base16; Base32 with the RFC 4648 standard, extended-hex, z-base-32, DNSCurve and DNSSEC (RFC 5155) alphabets; Base64 in standard, URL-safe, unpadded, MIME, IMAP modified-UTF-7, bcrypt, crypt(3) and BinHex alphabets; Base58 with Bitcoin, Flickr and Ripple alphabets and Base58Check; Base45 (RFC 9285); Ascii85, Base85 (RFC 1924) and Z85; and basE91.

Different alphabets exist because each target channel forbids different characters: URL-safe Base64 replaces '+' and '/', and Base45 is designed to fit QR-code alphanumeric mode. Variants also differ in padding, line wrapping and case rules, so decoders must be configured for the exact flavour expected. Base64 is the most widely used, while hex is simplest to read.

History

2006–2022
  1. Specified in RFC 4648 section 8

  2. Specified in RFC 4648 section 6

  3. Specified in RFC 4648 section 7

  4. Specified in RFC 4648

  5. Specified in RFC 5155 section 3.3

  6. Specified in RFC 9285

Security notes

Encodings provide no security: anyone can decode them. Base58Check's checksum detects typing errors but not deliberate changes. Decoders must reject non-canonical input where uniqueness matters, such as in signatures.

Typical uses

Embedding binary in JSON, URLs and emailDisplaying keys, hashes and addressesPEM and data URIsQR codes (Base45)

Sizes

The registry declares no fixed sizes for this algorithm.

Use it

from nextssl_demo import NextSSL

ns = NextSSL()              # safe API: safe and standard tiers
text = ns.call("encode_with", "base58", None, b"hello")[0]
data = ns.call("decode_with", "base58", None, text)[0]

Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.

Frequently asked questions

What is Base58?

Base58 is an encoding in the Base-N encodings family. Base-N encodings represent arbitrary binary data using a restricted alphabet of printable characters so it can travel through text-only channels such as email, URLs, JSON or DNS.

Who designed Base58 and when?

Base58 belongs to the Base-N encodings family, first published in 2006 by Simon Josefsson (editor). Its origin: RFC 4648 and related specifications.

Which standards define Base58?

Base58 is referenced by Bitcoin base58 (draft-msporny-base58).

Is Base58 safe to use?

Base58 is in the standard tier. Standardised and sound. Reachable from the safe API. It can be called from the safe API.

What other Base-N encodings variants are there?

NextSSL also registers ascii85, base16, base32, base32-dnscurve, base32-dnssec, base32hex and more in the Base-N encodings family.