Base58 is everywhere in crypto — Solana addresses, Bitcoin wallets, IPFS CIDs. Here's how to work with it in TypeScript without pulling in a dependency tree.
Why Base58?
Base58 is like Base64 but without characters that look similar: no 0, O, I, or l. This makes it perfect for addresses and keys that humans need to read or type.
Quick Start
npm install base58-core
import { encode, decode } from 'base58-core';
const encoded = encode(new Uint8Array([72, 101, 108, 108, 111]));
console.log(encoded); // "9Ajdvzr"
const decoded = decode(encoded);
console.log(decoded); // Uint8Array
With Checksum (Base58Check)
Bitcoin and Solana addresses use Base58Check — base58 with a 4-byte SHA-256 checksum:
import { encodeChecked, decodeChecked } from 'base58-core';
const address = encodeChecked(publicKeyBytes);
const verified = decodeChecked(address);
CLI Usage
npx base58-cli encode "hello"
// 9Ajdvzr
Why Not bs58?
bs58 is the most popular option, but it depends on base-x. If you want something with zero dependencies, native TypeScript types, and ESM/CJS dual builds, base58-core covers the same API.
Top comments (0)