ホームページ / 数学の計算機 / 2進数計算機

2進数計算機

以下の計算ツールを使用して、2つの2進数値の加算、減算、乗算、除算を行い、また2進数と10進数を相互に変換します。

数値を変更して「計算」ボタンをクリックしてください

2進数計算—加算・減算・乗算・除算

= ?

2進数を10進数に変換

2進数値: = ?

10進数を2進数に変換

10進数値: = ?

インタラクティブ・ビットレジスタ&2の累乗可視化

8ビット対話型スイッチレジスタ(クリックで0/1切り替え)
2進数: 10101010
10進合計: 170
16進数: 0xAA
2の累乗ビット重み付けの内訳 有効なビットは緑色でハイライト表示

Understanding the Binary Number System (Base-2)

The binary numeral system, or base-2, is the mathematical bedrock of contemporary computation, digital hardware, and networking architectures. Unlike the decimal system (base-10), which employs ten distinct symbols (0 through 9) governed by powers of ten, binary operates exclusively with two discrete states: zero (0) and one (1). Each binary digit is termed a bit. In computer engineering, physical transistors represent these bits through distinct voltage levels—such as zero volts for logic LOW (0) and 3.3 or 5 volts for logic HIGH (1). Grouping eight bits creates a byte, capable of expressing 256 distinct permutations (from 0 to 255 in unsigned decimal notation), which forms the atomic unit of addressable computer memory.

Binary Arithmetic: Addition, Subtraction, Multiplication, and Division

Performing arithmetic calculations directly in binary mirrors standard decimal column-based math, simplified by having only two possible digits. In binary addition, four elementary axioms govern every bit pair: 0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1, and 1 + 1 = 10 (which produces 0 in the current position and generates a carry of 1 into the next higher place value). When three ones meet (1 + 1 + 1 from a previous carry), the sum is 11 (1 with a carry of 1). Binary subtraction uses borrowing: 0 - 0 = 0, 1 - 0 = 1, 1 - 1 = 0, and 0 - 1 borrows a 2 from the adjacent left column, yielding 2 - 1 = 1.

Binary multiplication is exceptionally streamlined: multiplying by 0 yields all zeros, while multiplying by 1 simply copies the multiplicand. Hardware Arithmetic Logic Units (ALUs) execute multiplication by generating shifted partial products and accumulating them via high-speed parallel adders. Similarly, binary division relies on the standard long division algorithm of successive left-to-right subtraction and quotient digit allocation (either 0 or 1), yielding both an exact integer quotient and a terminal remainder.

Step-by-Step Conversion Algorithms: Base-2 and Base-10

Converting a binary integer to its decimal equivalent relies on positional expansion. Each bit at index n (counted from 0 at the rightmost least-significant bit) carries a decimal weight of 2n. To convert 10101010₂ to decimal:

  • Bit 7 (1): 1 × 27 = 128
  • Bit 6 (0): 0 × 26 = 0
  • Bit 5 (1): 1 × 25 = 32
  • Bit 4 (0): 0 × 24 = 0
  • Bit 3 (1): 1 × 23 = 8
  • Bit 2 (0): 0 × 22 = 0
  • Bit 1 (1): 1 × 21 = 2
  • Bit 0 (0): 0 × 20 = 0
  • Total Sum: 128 + 32 + 8 + 2 = 170₁₀

Conversely, to convert a decimal integer to binary, the successive division by 2 algorithm is applied. The integer is divided by 2, the integer quotient becomes the input for the next cycle, and the remainder (0 or 1) is recorded. Once the quotient reaches zero, the remainders are read in reverse order (from bottom to top) to produce the exact binary sequence. For fractional quantities, the fractional portion is repeatedly multiplied by 2, and the overflow whole numbers (0 or 1) are recorded from top to bottom.

Signed Numbers, Two's Complement, and Practical Real-World Applications

In modern microprocessors, negative numbers are encoded via Two's Complement notation. Unlike sign-magnitude systems, two's complement eliminates the problem of dual zeros (+0 and -0) and enables the ALU to use identical electronic addition circuitry for both addition and subtraction. To compute the two's complement of an N-bit integer, invert every bit (forming the one's complement) and add 1. Beyond computer CPU registers, binary logic powers Internet Protocol (IPv4/IPv6) CIDR subnet masking, cryptographic hash functions (such as SHA-256 and AES), digital audio PCM sampling, and hardware communication protocols including I2C, SPI, and UART.

よくある質問(FAQ)

IPとCIDRからネットワークアドレスとブロードキャストアドレスを求めるには?
IPアドレスとサブネットマスクの両方を32ビットの2進数整数に変換します。IPとマスクの間でビット単位のAND演算を行ってネットワークアドレスを取得します。次にサブネットマスクを反転してワイルドカードマスクを求め、ネットワークアドレスとワイルドカードマスクの間でビット単位のOR演算を行うことでブロードキャストアドレスを取得します。
なぜ /30 サブネットは2つの利用可能IPアドレスしか提供しないのですか?
/30プレフィックスは 32 - 30 = 2 ホストビットを残します。アドレスの総数は 2^2 = 4 です。先頭アドレスがネットワーク識別子、末尾アドレスがブロードキャスト用に予約されているため、利用可能なホストアドレスは 4 - 2 = 2 個となり、拠点間WAN接続の標準として用いられます。
クラスフルアドレッシングとクラスレス(CIDR)の違いは何ですか?
クラスフルアドレッシング(RFC 791)は、先頭オクテットに基づいてIPアドレスをクラスA(/8)、B(/16)、C(/24)に厳格に分類し、膨大なアドレスの浪費を招きました。CIDR(RFC 1519)はこの固定境界を撤廃し、任意のプレフィックス長(/1〜/32)のサブネットマスクと柔軟な経路集約を可能にしました。
Ciscoルーターの設定でワイルドカードマスクはどのように機能しますか?
ワイルドカードマスクは、IPアドレスのどのビットが一致すべきか(ビットが0の箇所)と、どのビットが任意でよいか(ビットが1の箇所)をルーターに指示します。255.255.255.255からサブネットマスクを減算して算出されます。例えば /26 サブネット(マスク 255.255.255.192)の場合、ワイルドカードマスクは 0.0.0.63 となります。

最終レビュー:

保存された計算
No saved calculations yet.