DevToolBox

Base58 Encoder / Decoder

テキストをBitcoinアルファベット準拠のBase58にエンコード・デコードします。全てブラウザ内で処理。

How to Use the Base58 Encoder / Decoder

This free online Base58 tool converts text to Base58 and back using the Bitcoin alphabet. Choose "エンコード" (Encode) or "デコード" (Decode), enter your text, and click the button. UTF-8 input is fully supported — everything runs locally in your browser using BigInt arithmetic, with no external library involved.

What is Base58?

Base58 is a binary-to-text encoding that represents data using 58 symbols: digits and letters, minus 0 (zero), O (capital O), I (capital I), l (lowercase L), and the symbols + and /. Unlike Base64 and Base32, Base58 is not defined by a formal RFC — it is a de facto standard popularized by Bitcoin, and different implementations can vary slightly in edge-case handling.

Base58 vs Base64 vs Base32

Base64 packs data most efficiently (about 133% of the original size, using 64 symbols) but includes visually ambiguous characters and symbols that need escaping in URLs. Base32 (RFC 4648, 32 symbols) trades efficiency (about 160%) for case-insensitivity. Base58 sits between them: close to Base64's efficiency, while deliberately excluding characters that are easy to misread when handwritten, read aloud, or displayed in certain fonts.

Where Base58 Is Used

The best-known use is Bitcoin and other cryptocurrency addresses and WIF-format private keys, which use Base58Check — Base58 applied to data with a 4-byte checksum appended. Base58 is also used for IPFS Content Identifiers (CID v0) and for generating short, human-friendly IDs such as Flickr's short photo URLs.

Base58エンコード・デコードツールについて

このツールはBitcoinアルファベット準拠のBase58形式でテキストをエンコード・デコードします。UTF-8に完全対応しており、全ての処理はブラウザ内で完結するためデータがサーバーに送信されることはありません。Base58はBase32(RFC 4648)やBase64(RFC 4648)と違い正式なRFCで定義された標準ではなく、Bitcoinが広めた事実上の業界標準です。0/O/I/lのような紛らわしい文字と、URLで問題になりやすい+と/を除いた58文字だけを使います。

既存のBase32 Encoder / DecoderBase64 Encoder / DecoderがRFC 4648準拠の標準的な変換を提供するのに対し、本ページはBitcoinアドレスなどで実際に使われている「紛らわしい文字を含まない・記号を使わない」Base58形式に特化した変換を提供します。

実務での活用例

1. Bitcoinアドレス・WIF秘密鍵形式の構造理解

Bitcoinのアドレスや秘密鍵(WIF形式)はBase58Check(チェックサム付きBase58)で表現されます。本ツールでBase58部分のエンコード・デコードの仕組みを学べますが、実際に使用中のアドレス・秘密鍵を外部ツールに貼り付けるのは避け、テスト用の値のみで確認してください。

2. IPFS CIDのデコード確認

IPFSのContent Identifier(CID v0)はBase58(Bitcoinアルファベット)でエンコードされた文字列です。CIDをデコードしてハッシュ部分のバイト列の長さや先頭バイトを確認する、といったデバッグに使えます。

3. 誤読の少ない短縮ID・招待コードの設計検討

手入力や口頭伝達が想定される短い識別子(招待コード、短縮URLのIDなど)を設計する際、Base58の「紛らわしい文字を含まない」特性はBase62やBase64より入力ミスを減らすのに役立ちます。

よくあるエラーと対処 / Common Errors and Fixes

エラー / Error原因 / Cause対処 / Fix
Base64の文字列を貼ったらエラーになる
Pasting a Base64 string causes an error
Base64は0, O, I, lや+, /, =を含み、Base58のアルファベットと異なる
Base64 uses characters Base58 excludes (0, O, I, l, +, /, =)
Base64 Encoder / Decoderを使用する
Use the Base64 tool instead
先頭ゼロバイトの扱いを誤解する
Misunderstanding leading zero bytes
先頭の0x00バイトは数値としては消えるため、先頭に"1"を並べる特別ルールで補っている
Leading 0x00 bytes vanish numerically, so Base58 prepends one "1" per zero byte
先頭の"1"の個数は元データの先頭ゼロバイト数と一致することを確認する
Count leading "1"s against the expected number of leading zero bytes
Base58Checkのチェックサムと素のBase58を混同する
Confusing Base58Check with plain Base58
Bitcoinアドレスは通常Base58Checkで、4バイトのチェックサムを付加した値をBase58エンコードしている
Bitcoin addresses use Base58Check, which appends a 4-byte checksum before encoding
本ツールは素のBase58のみに対応。チェックサム検証には専用のアドレス検証ツールを使う
This tool only does plain Base58 — use a dedicated address validator for checksum verification
大きな入力の変換が遅く感じる
Large inputs feel slow to convert
バイト列→BigIntの変換量はデータ長に対して増えるため、数MB規模の入力では時間がかかる
Byte-to-BigInt conversion scales with input size; multi-MB inputs are slow
短い識別子・キー用途を想定したツールであり、大容量バイナリの変換には不向き
This tool targets short identifiers/keys, not large binary blobs
デコード結果が文字化けする
Decoded output looks garbled
元データがUTF-8テキストではないバイナリ(暗号鍵など)だと、テキストとしてデコードできない
If the source data isn't UTF-8 text (e.g. a binary key), decoding as text fails or garbles
バイナリ用途では本ツールをテキスト専用と割り切り、hex系ツールの利用も検討する
Treat binary payloads as bytes, not text — a hex tool may suit binary data better

言語別コード例 / Code Examples by Language

JavaScript (BigInt)

const ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";

function base58Encode(bytes) {
  let zeros = 0;
  while (zeros < bytes.length && bytes[zeros] === 0) zeros++;
  let num = 0n;
  for (const b of bytes) num = (num << 8n) + BigInt(b);
  let out = "";
  while (num > 0n) {
    out = ALPHABET[Number(num % 58n)] + out;
    num /= 58n;
  }
  return "1".repeat(zeros) + out;
}

Python

# pip install base58 (Python標準ライブラリには含まれない)
import base58

encoded = base58.b58encode(b"Hello").decode()   # "9Ajdvzr"
decoded = base58.b58decode(encoded)              # b"Hello"

Node.js

// npm install bs58
import bs58 from "bs58";

const encoded = bs58.encode(Buffer.from("Hello"));  // "9Ajdvzr"
const decoded = bs58.decode(encoded);                 // <Buffer 48 65 6c 6c 6f>

Go

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

encoded := base58.Encode([]byte("Hello")) // "9Ajdvzr"
decoded := base58.Decode(encoded)

Base58はBase32・Base64と異なり標準ライブラリを持たない言語が多く、パッケージごとにAPIが異なります。本ツール自身はいかなる外部ライブラリにも依存せず、BigIntによる素直な多倍長演算のみで実装しています。

Before / After 実例 / Before & After

例1: シンプルな文字列 / A simple string

Hello   →   9Ajdvzr

例2: スペースを含む文字列 / A string with a space

Hello World   →   JxF12TrwUP45BMd

例3: 日本語 UTF-8 / Japanese UTF-8

こんにちは   →   7NAasPYBzpyEe5hmwr1KL

例4: 先頭ゼロバイト / A leading zero byte

0x00 (1バイトのみ)   →   1

先頭のゼロバイトはBase58の数値表現では消えてしまうため、バイト数を保つ目的で先頭ゼロバイト1個につき"1"を1文字加える特別ルールがあります。

Leading zero bytes disappear in Base58's numeric representation, so one leading "1" character is prepended per leading zero byte to preserve the byte count.

Why browser-only? / なぜブラウザ完結か

Base58 is the encoding behind Bitcoin addresses and WIF-format private keys — values where a leaked private key means an irreversible loss of funds. A server-side encoder would see whatever you paste in its request body and access logs. This tool performs every step of the encode/decode process — BigInt arithmetic, alphabet lookup, leading-zero handling — in plain JavaScript inside your browser tab. No network request is made; verify it yourself in DevTools → Network. As a rule, never paste a real, in-use private key into any web tool, including this one — treat this page as a format-inspection tool for test values, not a place to process production keys.

Base58はBitcoinアドレスやWIF形式の秘密鍵に使われる形式で、秘密鍵が漏洩すれば資金を取り戻せません。サーバー型の変換ツールはその値をリクエストボディやアクセスログに残す可能性があります。本ツールはBigInt演算・アルファベット変換・先頭ゼロ処理のすべてをブラウザ内のJavaScriptだけで実行し、ネットワーク通信を一切行いません。稼働中の秘密鍵は本ツールを含むいかなるWebツールにも貼り付けず、テスト用途に留めることを推奨します。

開発をもっと効率的に

PR