Decode Base58

About Base58

What is Base58?

Base58 is a binary-to-text encoding that avoids visually ambiguous characters such as 0, O, I, and l. This tool uses the Bitcoin alphabet.

Why use Base58?

Base58 is commonly used for identifiers and addresses that people may need to read, copy, or type accurately.

Base58 example

Hello -> 9Ajdvzr
9Ajdvzr -> Hello

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