Stax
Tools

Number Base Converter

Convert numbers between binary, octal, decimal, and hexadecimal.

Binary
Base 2
Octal
Base 8
Decimal
Base 10
Hexadecimal
Base 16

コンピューティングにおける数値系

基数別の一般的な使用例

クイック変換リファレンス

コンピューターはすべてを2進数(基数2)として保存・処理します。しかし1と0の長い文字列を読むのは人間にとってエラーが起きやすいため、より compact な表現を使います:8進数(基数8)と16進数(基数16)。各16進数の1桁はちょうど4ビットの2進数にマップされ、変換が完全で頭の中で行えます。

いくつかの16進数→2進数のペアを記憶すると手動変換がはるかに速くなります:0=0000、1=0001、4=0100、8=1000、A=1010、F=1111。任意の16進数値は各16進数の1桁をその4ビット2進数相当に置き換えるだけで2進数に変換できます。

コンピューターサイエンスの学生はデジタルロジックと低レベルプログラミングを理解するために基数変換の演習を行います。組み込みシステムエンジニアはデータシートのレジスタマップを読む際に16進数と2進数の間を変換します——マイクロコントローラーのレジスタは16進数アドレスで記述されますが、2進数値のビット演算で操作されます。ネットワークエンジニアはサブネッティングと CIDR 表記を理解するために IP アドレスを10進数と2進数の間で変換します。セキュリティプロフェッショナルはマルウェア分析中に16進数エンコードされたペイロードとシェルコードをデコードします。

2進数との間のすべての基数変換は2の累乗を中心に展開します。最初の16乗を記憶することは非常に価値があります:2^0=1、2^1=2、2^2=4、2^3=8、2^4=16、2^5=32、2^6=64、2^7=128、2^8=256、2^9=512、2^10=1024、2^16=65536、2^32=4,294,967,296。これらの数値はコンピューティングに常に現れます——メモリサイズ(256 MB、1 KB = 1024バイト)・ポート番号・色チャンネル値(0〜255)・2進数フラグ。

10進数を2進数に変換するには:2で繰り返し割り、余りを下から上に記録します。例えば、42 ÷ 2 = 21 余り0、21 ÷ 2 = 10 余り1、10 ÷ 2 = 5 余り0、5 ÷ 2 = 2 余り1、2 ÷ 2 = 1 余り0、1 ÷ 2 = 0 余り1 → 余りを下から上に読む:101010。2進数を10進数に変換するには:各ビットにその位の2の累乗を掛けて合計します。他の基数ペアの場合は、まず10進数に変換してから目標の基数に変換してください。

  • 2進数——CPU 命令セット・ビットマスキング・フラグ・ネットワークサブネットマスク
  • 8進数——Unix ファイルパーミッション(chmod)・一部のレガシープロトコル
  • 10進数——人間が読みやすい数値・ポート番号・IP アドレス
  • 16進数——メモリアドレス・カラーコード・SHA ハッシュ・バイトシーケンス・UUID 値

よくある質問

What is a number base?
A number base (or radix) defines how many digits a numeral system uses. Decimal (base 10) uses 0–9. Binary (base 2) uses 0 and 1. Octal (base 8) uses 0–7. Hexadecimal (base 16) uses 0–9 and A–F.
Why do programmers use hexadecimal?
Hex is compact and maps neatly to binary: each hex digit represents exactly 4 binary bits (a nibble). This makes it easy to read memory addresses, color codes (#FF5733), file signatures, and bytecode without long binary strings.
How do I convert binary to decimal?
Multiply each bit by its positional value (powers of 2 from right to left) and sum the results. For example, 1010 in binary = 1×8 + 0×4 + 1×2 + 0×1 = 10 in decimal. This converter does it instantly for any base.
What is octal used for?
Octal was common in early computing and is still used in Unix/Linux file permission notation (e.g., chmod 755). Each octal digit represents exactly 3 bits, making it a compact alternative to binary.
What is the nibble grouping in binary?
Nibble grouping splits binary output into groups of 4 bits (e.g., 1010 1101 instead of 10101101). This matches hex digit boundaries, making it easier to convert mentally between binary and hexadecimal.

関連ツール