Done

🔢 Decimal ↔ Binary Converter

Convert decimal numbers to binary (base‑2), binary to decimal, hex, and octal — instantly, with step‑by‑step breakdown and bit grouping.

Input
Results
42
Decimal
101010
6
Bits
1
Bytes
2A
Hex
52
Octal
2⁵
Highest power
Binary (base 2)
101010
Octal (base 8)
52
Decimal (base 10)
42
Hex (base 16)
2A

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.

Example: Convert 42 to binary
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
Read remainders bottom → top: 101010

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.

Example: Convert 101010 to decimal
1×2⁵ + 0×2⁴ + 1×2³ + 0×2² + 1×2¹ + 0×2⁰
= 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 10
4 100
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

What is 255 in binary?
255 in binary is 11111111. It is the largest unsigned 8-bit integer (all eight bits set to 1). In hexadecimal it is FF , in octal it is 377 . It is commonly seen as the maximum value of each color channel in RGB (0–255).
What is 42 in binary?
42 in binary is 101010. To arrive at this: divide 42 repeatedly by 2, collecting remainders 0, 1, 0, 1, 0, 1, then read bottom to top → 101010. It requires 6 bits to store. 42 is famously "the answer to life, the universe, and everything" in Douglas Adams' The Hitchhiker's Guide to the Galaxy .
How do you convert binary to decimal?
Multiply each bit by its positional power of 2, then sum all results. Start at the rightmost bit (position 0). For example:

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.
What is 2's complement and when is it used?
2's complement is the standard encoding for signed integers in almost all modern computers. To represent a negative number:

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.
How many bits does a decimal number need?
The minimum bits needed = 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
What is 0 in binary?
0 in binary is simply 0. It is represented by a single bit (or however many bits your data width requires — e.g. 00000000 in 8-bit form). Zero is the only number that is identical in every positional numeral system.
What is 1024 in binary?
1024 in binary is 10000000000 (1 followed by ten zeros). It equals 2¹⁰ and is widely known as one kibibyte (KiB) in computing — the basis of binary file size measurements (1 KiB = 1024 bytes, 1 MiB = 1024 KiB, and so on).
Why do computers use binary instead of decimal?
Computers use binary because electronic components (transistors) naturally operate in two states: on (1) or off (0) . A two-state system is:

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.
What is a nibble, byte, word in binary?
Standard binary data widths:

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

Decimal → Binary Formula
n = Σ bᵢ × 2ⁱ
where bᵢ is each bit (0 or 1) and i is the bit position from right (starting at 0).
Bits required for value n
⌊log₂(n)⌋ + 1
Round down log base 2 of n, then add 1. E.g. for 255: ⌊7.99⌋ + 1 = 8 bits.
2's Complement (negative n, b bits)
2ᵇ − |n|
E.g. −42 in 8-bit: 256 − 42 = 214 = 11010110₂
Max unsigned value (b bits)
2ᵇ − 1
8-bit max = 255, 16-bit max = 65,535, 32-bit max = 4,294,967,295
History
No conversions yet.
Quick Samples
How it works
Decimal → Binary
Divide by 2 repeatedly. Read remainders bottom-to-top.
Binary → Decimal
Each bit × 2ⁿ (right to left, n starts at 0). Sum all.
Signed / 2's Complement
Invert bits of positive, add 1.
Hex ↔ Binary
Each hex digit = exactly 4 binary bits (one nibble).
Quick Answers
255 in binary
11111111
8 bits, hex: FF
128 in binary
10000000
8 bits, hex: 80
1 in binary
1
1 bit
0 in binary
0
1 bit
1024 in binary
10000000000
11 bits = 2¹⁰