Base58 Encoder & Decoder

Decode Base58

About Base58

What is Base58?

Base58 treats a byte sequence as one large integer and writes it with the Bitcoin alphabet 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz. Leading zero bytes become leading 1 characters, preserving a byte-for-byte round trip.

Why use Base58?

Use Base58 for compact identifiers that people copy or type because it omits 0, O, I, and l. This is raw Bitcoin-alphabet Base58, not Base58Check: it adds no version or checksum, and other Base58 alphabets are incompatible.

Base58 in JavaScript

// npm install bs58
import bs58 from 'bs58';

const encoded = bs58.encode(Buffer.from('Hello'));
console.log(encoded);
// Output: 9Ajdvzr

const decoded = Buffer.from(bs58.decode('9Ajdvzr')).toString('utf8');
console.log(decoded);
// Output: Hello
				

Base58 in Go

package main

import (
	"fmt"

	"github.com/btcsuite/btcutil/base58"
)

func main() {
	encoded := base58.Encode([]byte("Hello"))
	fmt.Println(encoded)
	// Output: 9Ajdvzr

	decoded := base58.Decode("9Ajdvzr")
	fmt.Println(string(decoded))
	// Output: Hello
}
				

Base58 in PHP

<?php
// composer require tuupola/base58
require 'vendor/autoload.php';

use Tuupola\Base58;

$base58 = new Base58(["characters" => Base58::BITCOIN]);

$encoded = $base58->encode("Hello");
echo $encoded . "\n";
// Output: 9Ajdvzr

$decoded = $base58->decode("9Ajdvzr");
echo $decoded . "\n";
// Output: Hello