Binary & Hexadecimal Converter

Instantly convert between Binary, Hexadecimal, Decimal, and Octal radix systems with live two-way synchronization, interactive bit-matrix toggle, and two's complement representation.

Multi-Radix Converter & Interactive Bit Matrix
Digits: 0–9
Bits: 0, 1
0–9, A–F
0x
Digits: 0–7
0o
Text Representation

Interactive Bit Matrix (Click any bit to toggle)

Signed Value (Two's Complement)
+437
Unsigned Value
437
Hamming Weight (Set Bits)
6 bits set (37.5%)
Bitwise NOT (~X)
0xFE4A (-438)
Leading Zeros
7 zeros
Byte Alignment
2 Bytes (16 bits)
Step-by-Step Conversion Derivation:

Positional Number Systems: Binary, Decimal, Hexadecimal & Octal

In computational science and digital electronics, positional numeral systems represent numerical quantities through radix (base) mathematics. Modern computing architectures operate natively on binary logic (base 2) governed by Boolean algebra and physical transistor states (voltage high vs. voltage low). To render binary byte structures readable to humans, hexadecimal (base 16) and octal (base 8) serve as compact, aligned representations.

Mathematical Foundations of Radix Systems

Any positive real integer $N$ represented in a positional base $b$ with digits $d_i \in \{0, 1, \dots, b-1\}$ evaluates to its standard decimal equivalent through polynomial summation:

$$N_{10} = \sum_{i=0}^{k-1} d_i \cdot b^i = d_{k-1} b^{k-1} + d_{k-2} b^{k-2} + \dots + d_1 b^1 + d_0 b^0$$

The primary computational radices include:

  • Binary (Base 2): Allowed digits $\{0, 1\}$. Weights correspond to powers of two ($2^0=1, 2^1=2, 2^2=4, 2^3=8, \dots$).
  • Octal (Base 8): Allowed digits $\{0, 1, 2, 3, 4, 5, 6, 7\}$. Each octal digit directly encodes exactly 3 binary bits ($2^3 = 8$).
  • Decimal (Base 10): Standard Hindu-Arabic system with digits $\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9\}$.
  • Hexadecimal (Base 16): Digits $\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, \text{A}, \text{B}, \text{C}, \text{D}, \text{E}, \text{F}\}$ where $\text{A}=10, \dots, \text{F}=15$. Each hex digit represents exactly one 4-bit nibble ($2^4 = 16$).

Conversion Algorithms: The Euclidean Division Chain

Converting an integer from Decimal (base 10) to any target base $b$ utilizes successive Euclidean integer division with remainders:

$$N = q_0 \cdot b + r_0, \quad q_0 = q_1 \cdot b + r_1, \quad \dots, \quad q_{m-1} = 0 \cdot b + r_m$$

The digits in base $b$ are the remainders $r_0, r_1, \dots, r_m$ read in reverse sequence (from most significant digit $r_m$ down to least significant digit $r_0$).

Direct Bit Grouping: Binary $\longleftrightarrow$ Hexadecimal

Because $16 = 2^4$, the conversion between binary and hexadecimal requires zero arithmetic division. Bits are grouped into 4-bit sequences (nibbles) from right to left:

Hex Digit Binary (4-Bit) Decimal Value Hex Digit Binary (4-Bit) Decimal Value
0x0000000x810008
0x1000110x910019
0x2001020xA101010
0x3001130xB101111
0x4010040xC110012
0x5010150xD110113
0x6011060xE111014
0x7011170xF111115

Two's Complement Signed Integer Representation

In computer hardware, negative integers are encoded using Two's Complement. In an $n$-bit register, the most significant bit (MSB) carries a negative positional weight of $-2^{n-1}$. To negate an integer $X$:

$$[-X]_{2\text{'s}} = 2^n - X = (\sim X) + 1$$

Where $\sim X$ denotes bitwise inversion (flipping all $0$s to $1$s and $1$s to $0$s), followed by incrementing the least significant bit by 1.

Step-by-Step Conversion Example

Convert decimal number $N = 437_{10}$ into Binary and Hexadecimal:

  1. Decimal to Binary via Division by 2: $$\begin{aligned} 437 \div 2 &= 218 \text{ R } 1 \\ 218 \div 2 &= 109 \text{ R } 0 \\ 109 \div 2 &= 54 \text{ R } 1 \\ 54 \div 2 &= 27 \text{ R } 0 \\ 27 \div 2 &= 13 \text{ R } 1 \\ 13 \div 2 &= 6 \text{ R } 1 \\ 6 \div 2 &= 3 \text{ R } 0 \\ 3 \div 2 &= 1 \text{ R } 1 \\ 1 \div 2 &= 0 \text{ R } 1 \end{aligned}$$ Reading remainders bottom to top yields: $\mathbf{110110101_2}$.
  2. Binary to Hexadecimal via Nibble Grouping: Pad with leading zeros to form 4-bit nibbles: $$[0001] \quad [1011] \quad [0101]_2$$ $$0001_2 = 1_{16}, \quad 1011_2 = \text{B}_{16} \, (11), \quad 0101_2 = 5_{16}$$ Combining gives: $\mathbf{0x1B5_{16}}$.
  3. Verification via Hexadecimal Polynomial Expansion: $$1 \cdot 16^2 + 11 \cdot 16^1 + 5 \cdot 16^0 = 256 + 176 + 5 = 437_{10} \quad \checkmark$$
Google AdSense Bottom Banner • 728 × 90 / Responsive Matched
AD
Institutional Wealth & Health Analytics Platform
Empower your decision making with professional tools. Visit Official Partner.