Skip to content
uencoder

Multibase

Multibase is a self-describing encoding prefix scheme: a single-character prefix identifies the encoding of the data that follows (e.g., B for Base64, f for hex, z for Base58BTC), proposed by IPFS/Multiformats.

Purpose

It makes an encoded string carry its own encoding information, so the decoder can identify it without prior agreement and avoid ambiguity.

Mechanism

The prefix character comes from the Multibase registry: f = base16, F = base16upper, b = base32, B = base32upper, z = base58btc, m = base64, M = base64upper, and so on. To decode, look up the first character to determine the encoding, then decode the remainder accordingly.

Use cases

  • IPFS CIDs (content identifiers)
  • libp2p multiaddr encoding
  • W3C DIDs (decentralized identifiers)
  • Self-describing data exchange

Examples

  • Input
    0x48656c6c6f
    Output
    f48656c6c6f

    The f prefix denotes hex

Common errors

Using an unregistered prefix character
Consult the Multibase registry and use registered prefixes only

Related terms

Related tools

References