基数変換
2進数・8進数・10進数・16進数を相互変換。大きな整数もOK。
基数変換とは
基数変換とは、数値を2進数・8進数・10進数・16進数などの異なる基数表現に切り替える処理です。プログラミングやネットワーク設定で使われます。
🔒 処理はすべてブラウザ内で完結し、データは送信されません。
このツールの前提
- 処理場所
- このページのブラウザ内(JavaScript / Canvas)
- アップロード
- なし — ファイルは端末の外に出ません
- オフライン
- ページを開いた後は通信不要
Radix conversion, with arbitrary precision where it matters
Any base from 2 to 36 is supported; digits above 9 are letters a–z, and case is not significant on input. The conversion is done with BigInt rather than Number, because JavaScript's Number loses integer precision above 2^53 — a 20-digit hexadecimal value would otherwise come back with its last digits rounded to zeros.
That precision boundary is not theoretical. Snowflake IDs, Ethereum wei amounts, and Bitcoin satoshi values all exceed 2^53 routinely, and a conversion that goes through Number silently returns a different number. BigInt handles them exactly, at the cost of working with strings rather than numbers.
The prefixes and the invalid digits
Input is read as digits in the stated base, with an optional 0x, 0b or 0o prefix for hexadecimal, binary and octal. Reading '010' as decimal 10 rather than octal 8 is the modern convention; older JavaScript parseInt treated a leading zero as octal, which is why some legacy systems still disagree about the same literal.
A digit outside the base is rejected rather than guessed at. '19' in base 8 is an error, not 17. Where a tool silently accepts it — by clamping to the largest digit, for example — the result is a plausible number that is simply wrong, which is harder to notice than a message.
Reading base-36 and base-62 output
Base 36 is what JavaScript's toString(36) produces — digits plus lowercase letters, no symbols. Bases above 36 are not expressible with a single case-insensitive alphabet, so implementations that offer base 62 pick a case-sensitive alphabet, and those alphabets differ between libraries. Never decode a base-62 value without knowing whose alphabet produced it.
For any base above 36, treat the string as opaque and use the same library on both ends. Round-tripping through a documented conversion is safe; hand-rolling one against an undocumented alphabet is how IDs are silently corrupted.
使い方
- 1.数値を入力
- 2.入力基数と出力基数を選択
- 3.結果をコピー
他の方法との比較
同じ変換をする方法は 3 つあります。ブラウザ内(このページ)、サーバー側の変換サービス、デスクトップアプリ。差がつくのは速度ではなく、ファイルがどこへ行くかと、無料でどこまでできるかです。
| 観点 | このツール | サーバー側の変換サービス | デスクトップアプリ |
|---|---|---|---|
| ファイルの処理場所 | このページのブラウザ内 | ベンダーのサーバー(アップロード後) | 自分の PC(アプリをインストール) |
| アカウント | 不要 | 多くの場合必要(無料枠の制限解除に登録を求める) | 不要(ライセンス認証は必要な場合あり) |
| 無料で扱えるサイズ | サイズ制限なし(回数制限もなし) | 数ファイル/時間、または 5〜10MB 程度で課金 wall | ディスクとメモリ次第 |
| 料金 | 無料。Pro は月 $9(大きいファイルと AI 機能のみ) | サブスクが一般的。おおむね月 $7〜15(2026 年 11 月時点) | 買い切り、またはサブスク |
| オフライン | 一度開けば通信不要 | 不可 | 可 |
| 20MB を処理し始めるまで | 待ち時間なし(アップロードが無い) | アップロードが支配的(10Mbps 上りで約 16 秒) | アプリの起動のみ |
| 保証できないこと | 出力は決定的です。他の実装と突き合わせて検証できます | 同じ(変換の原理は変わらない) | 同じ。ただし書式の再現はより忠実な場合がある |
サーバー側のサービスが優れている点は明確にあります。巨大なファイル、チームでの共有、変換履歴の管理、スクリプトからの自動化。逆に「1 回だけ、手元のファイルを別形式にしたい」という今回の用途では、アップロードの待ち時間と登録の手間だけが増えます。
よくある質問
対応する基数は?
2進数・8進数・10進数・16進数に対応しています。
大きな数も扱えますか?
JavaScriptの安全整数範囲内の値を正確に変換します。
この変換で失われるもの
エンコードとハッシュは Web Crypto API または純 JavaScript 実装で行います。出力は決定的で、同じ入力からは常に同じ結果になります。他のツールと突き合わせて検証できます。