How to Convert Decimal to Binary (Step-by-Step)
To convert a decimal number to binary, use the repeated division by 2 method. Divide the number by 2, record the remainder, then divide the quotient by 2 — repeat until the quotient is 0. The remainders read from bottom to top form the binary number.
| Division | Quotient | Remainder |
|---|---|---|
| 42 ÷ 2 | 21 | 0 |
| 21 ÷ 2 | 10 | 1 |
| 10 ÷ 2 | 5 | 0 |
| 5 ÷ 2 | 2 | 1 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
How to Convert Binary to Decimal
Multiply each bit by 2 raised to its position index (starting at 0 from the right), then sum all the products.
= 32 + 0 + 8 + 0 + 2 + 0 = 42
Understanding the Binary Number System
Base 2 vs Base 10
Computers use binary (base‑2: 0s and 1s) while humans use decimal (base‑10: 0–9). Every decimal integer has a unique binary representation. This converter shows the exact bit pattern a computer stores for any decimal value.
2's Complement
Negative numbers use 2's complement: invert all bits of the positive value, then add 1. Example: –5 in 8‑bit = 11111011₂ (decimal 251 unsigned). This elegantly handles arithmetic in hardware without a separate sign bit.
Bit Grouping
Bits are grouped in 4s (nibbles) or 8s (bytes) for readability. A nibble maps to one hex digit, so 1011 0101 = B5₁₆ . Padding adds leading zeros to reach standard widths: 8‑bit (byte), 16‑bit (word), 32‑bit (dword).
Where Binary Conversion Is Used
Computer Architecture
CPUs process everything in binary. Register values, memory addresses, and machine instructions are all bit patterns at the hardware level.
IP Addressing
IPv4 addresses are 32-bit binary numbers displayed in decimal dotted notation. Subnet masks (e.g. /24 = 255.255.255.0) are binary sequences.
Color Codes
RGB colors store three 8-bit values (0–255) per channel. #FF5733 = R:255, G:87, B:51 — all representable as 8-bit binary.
Cryptography
Encryption keys, hashes (SHA, MD5), and digital signatures all operate directly on binary data and are often expressed as hex.
Data Transmission
Serial and parallel protocols (UART, SPI, I²C) send data bit by bit. Understanding binary is essential for reading protocol analyzers.
CS Education
Binary conversion is a core topic in computer science, digital electronics, and programming courses at every level.
Decimal to Binary Reference Table (0 – 255)
Complete conversion chart for all 8-bit values. Each row shows the decimal number, its binary (base‑2), hexadecimal (base‑16), and octal (base‑8) equivalents.
| Decimal | Binary | Hex | Octal |
|---|
Powers of 2 Reference Table
Powers of 2 are the building blocks of binary arithmetic. Each bit position in a binary number represents a power of 2, starting from 2⁰ = 1 on the rightmost bit.
| Power | Value | Binary | Common Name |
|---|---|---|---|
| 2⁰ | 1 | 1 | 1 bit |
| 2¹ | 2 | 10 | — |
| 2² | 4 | 100 | — |
| 2³ | 8 | 1000 | 1 nibble (part) |
| 2⁴ | 16 | 10000 | 1 nibble max+1 |
| 2⁷ | 128 | 10000000 | — |
| 2⁸ | 256 | 100000000 | 1 byte max+1 |
| 2¹⁰ | 1,024 | 10000000000 | 1 Kibibyte (KiB) |
| 2¹⁶ | 65,536 | 1 0000000000000000 | 1 word max+1 |
| 2²⁰ | 1,048,576 | — | 1 Mebibyte (MiB) |
| 2³² | 4,294,967,296 | — | 4 GiB / IPv4 space |
| 2⁶⁴ | ~1.8 × 10¹⁹ | — | 64-bit integer max+1 |
Frequently Looked-Up Binary Conversions
The most commonly searched decimal-to-binary conversions — including networking values, color channel limits, and computing benchmarks.
Frequently Asked Questions
FF
, in octal it is
377
. It is commonly seen as the maximum value of each color channel in RGB (0–255).
Binary
1011
= 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 =
11
This tool automates this calculation instantly for any binary string.
1. Write the magnitude in binary (e.g. 5 = 00000101 in 8 bits)
2. Flip all bits → 11111010
3. Add 1 →
11111011
(this is −5 in 8-bit 2's complement)
The key advantage: addition and subtraction circuits work identically for both positive and negative numbers, simplifying CPU design.
floor(log₂(n)) + 1
for any positive integer
n
.
Quick reference:
• 0–1 → 1 bit | 2–3 → 2 bits | 4–7 → 3 bits
• 8–15 → 4 bits | 0–255 → 8 bits
• 0–65,535 → 16 bits | 0–4,294,967,295 → 32 bits
00000000
in 8-bit form). Zero is the only number that is identical in every positional numeral system.
• Reliable — easy to distinguish high vs low voltage
• Simple — arithmetic circuits using only AND, OR, NOT gates
• Noise-resistant — small fluctuations don't flip a 0 to a 1
In contrast, a decimal system would require 10 distinct voltage levels, making chips far more complex and error-prone.
• Bit — 1 binary digit (0 or 1)
• Nibble — 4 bits; represents one hexadecimal digit (0–F)
• Byte — 8 bits; stores values 0–255
• Word — 16 bits (architecture-dependent, often 32- or 64-bit on modern CPUs)
• Dword — 32 bits; stores 0–4,294,967,295
• Qword — 64 bits; the native integer size on modern 64-bit CPUs
Binary Conversion Formulas & Rules
Divide by 2 repeatedly. Read remainders bottom-to-top.
Each bit × 2ⁿ (right to left, n starts at 0). Sum all.
Invert bits of positive, add 1.
Each hex digit = exactly 4 binary bits (one nibble).