DevToolBox

Number Base Converter

2進数・8進数・10進数・16進数を相互変換します。大きな数値にも対応しています。

How to Use the Number Base Converter

This free online number base converter allows you to convert numbers between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16) instantly in your browser. Enter a number, select its base, and see all four representations simultaneously. The tool uses BigInt internally, so it supports arbitrarily large numbers without loss of precision.

Understanding Number Bases

A number base (or radix) determines how many unique digits are used to represent numbers. The decimal system we use daily has 10 digits (0-9). Binary uses just two digits (0 and 1) and is the foundation of all digital computing. Octal uses eight digits (0-7) and was historically used in computing for representing groups of three binary digits. Hexadecimal uses sixteen symbols (0-9 and A-F) and is widely used in programming for representing colors, memory addresses, and byte values in a compact format.

Common Use Cases

Developers and engineers frequently need to convert between number bases. Web developers work with hexadecimal color codes (e.g., #FF5733). Systems programmers read memory addresses and binary flags. Network engineers use binary for subnet mask calculations. Assembly language programmers work with hex opcodes. This converter handles all these scenarios, supporting numbers of any size thanks to JavaScript BigInt support. Input validation ensures that only valid digits for the selected base are accepted, preventing errors and confusion.

Large Number Support

Unlike many online converters that are limited by 32-bit or 64-bit integer ranges, this tool uses JavaScript BigInt to handle numbers of arbitrary precision. You can convert cryptographic hashes, large identifiers, or any other large number without worrying about overflow or precision loss. The conversion is performed entirely in your browser with no data sent to any server.

Features

  • Convert between binary, octal, decimal, and hexadecimal
  • All four conversions displayed simultaneously
  • BigInt support for arbitrarily large numbers
  • Input validation per selected base
  • Copy buttons for each output
  • Client-side only -- your data stays in your browser

基数変換ツールの使い方

この無料オンラインツールは、2進数・8進数・10進数・16進数の相互変換を行います。 数値を入力して基数を選択すると、4つの基数での表現が同時に表示されます。 BigIntを使用しているため、任意の大きさの数値を精度を損なうことなく変換できます。

基数とは

基数(radix)は、数を表すために使用する固有の桁数を決定します。 日常で使う10進数は0-9の10個の数字を使います。2進数はデジタルコンピューティングの 基礎で、0と1のみを使用します。16進数はプログラミングで色コード、メモリアドレス、 バイト値の表現に広く使われています。

大きな数値への対応

JavaScriptのBigIntを使用しているため、32ビットや64ビットの制限なく、 任意の精度で数値を変換できます。暗号ハッシュや大きなIDも正確に変換可能です。

よくある落とし穴と対処 / Common Pitfalls

落とし穴 / Pitfall問題 / Problem対処 / Fix
プレフィックスの解釈違い
Prefix misinterpretation
0x(16進)・0b(2進)・0o(8進)・先頭0(レガシー8進)が言語ごとに異なる扱い
0x / 0b / 0o / leading zero behave differently per language
変換時はプレフィックスを外し基数を明示(parseInt(s, 16) 等)
Strip prefixes and pass an explicit radix
parseInt の基数省略
parseInt without radix
parseInt("08") の挙動が環境で揺れる歴史的問題
Historic ambiguity with leading zeros
常に第2引数で基数を指定: parseInt(s, 10)
Always pass the radix explicitly
負数の2進表現の誤解
Misreading negative binary
(-5).toString(2) は "-101" を返し、2の補数表現ではない
toString(2) returns a signed string, not two's complement
2の補数が必要ならビット幅を決めて (n >>> 0).toString(2) 等で変換
Use unsigned coercion for two's complement views
小数の2進変換で無限循環
Fractions repeat in binary
0.1 は2進数では循環小数になり正確に表せない(浮動小数点誤差の根源)
0.1 has no finite binary representation
金額計算は整数(セント単位)か Decimal 型で扱う
Use integers or decimal types for money
53ビット超の整数が丸まる
Integers beyond 53 bits lose precision
Number型の安全整数は 2^53−1 まで。それ以上は末尾が狂う
Number is safe only up to 2^53−1
BigInt を使う(本ツールはBigInt使用で任意精度)
Use BigInt (as this tool does)

言語別コード例 / Code Examples

JavaScript

(255).toString(16)        // "ff"
parseInt("ff", 16)        // 255
BigInt("0xffffffffffffffff")  // 大きな値はBigIntで
(255).toString(2).padStart(8, "0")  // "11111111"

Python

hex(255), bin(255), oct(255)   # '0xff', '0b11111111', '0o377'
int("ff", 16)                   # 255
f"{255:08b}"                    # '11111111' (ゼロ埋め)

Shell

printf '%x\n' 255    # ff
echo $((16#ff))       # 255 (bashの基数記法)

変換例 / Before & After

10進 255 → 16進 FF → 2進 11111111 → 8進 377
10進 1024 → 16進 400 → 2進 10000000000
chmod 755 (8進) → 2進 111 101 101 (rwxr-xr-x)
#FF5733 → R=255, G=87, B=51 (色コードの分解)

Why browser-only?

Base conversion is pure math — there is no reason it should touch a server. This converter uses JavaScript's BigInt entirely in your browser, so memory addresses, file offsets, or ID values you are debugging never leave your machine. It is instant, works offline, and the DevTools Network tab will show zero requests.

変換対象がメモリアドレスやID値であっても、計算は全てブラウザ内で完結し外部送信はありません。 関連ツール: HEX Converter(バイト列⇔テキスト)、Unicode Inspector(文字のコードポイント)。

開発をもっと効率的に

PR