Skip to main content
🟢 Beginner

Binary to Decimal Converter

Convert binary numbers to decimal and decimal to binary instantly. Supports up to 64-bit numbers. This free converter gives instant, accurate results.

★★★★★ 4.8/5 · 📊 0 calculations · 🔒 Private & free

How Binary-to-Decimal Conversion Works

Binary (base-2) uses only the digits 0 and 1. Each position represents a power of 2, doubling from right to left. To convert binary to decimal, multiply each binary digit by its place value and sum the results.

Example: Convert 1011₂ to decimal

For decimal to binary, repeatedly divide by 2 and record remainders from bottom to top. 11 ÷ 2 = 5 R1, 5 ÷ 2 = 2 R1, 2 ÷ 2 = 1 R0, 1 ÷ 2 = 0 R1 → reading remainders upward: 1011.

This positional notation system works the same way as decimal — just with a different base. In decimal (base-10), the number 347 means 3×10² + 4×10¹ + 7×10⁰ = 300 + 40 + 7. Binary uses the same principle with powers of 2 instead of powers of 10.

Binary Place Values Reference

The 8-bit byte is the fundamental unit of computer storage. Here's the complete place value table for 8-bit numbers (0–255):

Bit positionPower of 2Decimal value
Bit 7 (MSB)2⁷128
Bit 62⁶64
Bit 52⁵32
Bit 42⁴16
Bit 38
Bit 24
Bit 12
Bit 0 (LSB)2⁰1

A byte can represent any value from 0 (00000000₂) to 255 (11111111₂). Two bytes (16 bits) cover 0–65,535. Four bytes (32 bits) cover 0–4,294,967,295.

Extended Powers of 2 Table

For programmers and computer scientists, knowing powers of 2 up to 2⁶⁴ is essential for understanding memory addressing, data types, and system limits:

PowerDecimal ValueSignificance
2⁰1Smallest unit (1 bit)
2⁸2561 byte range (0–255)
2¹⁰1,0241 KiB (kibibyte)
2¹⁶65,53616-bit range; TCP port limit
2²⁰1,048,5761 MiB (mebibyte)
2²⁴16,777,21624-bit color (16.7M colors)
2³⁰1,073,741,8241 GiB (gibibyte)
2³²4,294,967,29632-bit address space; IPv4 max
2⁴⁰1,099,511,627,7761 TiB (tebibyte)
2⁶⁴18,446,744,073,709,551,61664-bit address space; modern CPUs

Note the difference between binary prefixes (KiB, MiB, GiB — powers of 2) and SI prefixes (KB, MB, GB — powers of 10). 1 GB = 1,000,000,000 bytes; 1 GiB = 1,073,741,824 bytes. This ~7% difference explains why a "500 GB" hard drive shows as ~465 GiB in your OS (which typically uses binary units internally).

Common Binary Values in Computing

These binary values appear frequently in programming, networking, and system administration:

BinaryDecimalHexadecimalContext
0000000000x00NULL byte, black color channel
00001010100x0ALine feed (LF) character — Unix newline
00001101130x0DCarriage return (CR) — Windows newline part
00100000320x20Space character (ASCII)
01000001650x41ASCII 'A'
01100001970x61ASCII 'a' (differs from 'A' by bit 5)
011111111270x7FLocalhost IP (last octet); DEL character
100000001280x80Start of extended ASCII / sign bit
110000001920xC0Class C network prefix (192.x.x.x)
111111112550xFFBroadcast; max byte; white in RGB

Binary, Hexadecimal, and Octal Comparison

Programmers use different number bases depending on context. Here's how the same values appear in each system:

DecimalBinaryHexadecimalOctalUse Case
000000x00o0Zero / null
701110x70o7Unix permission (rwx)
1010100xA0o12
1511110xF0o17Max 4-bit (nibble)
16100000x100o20
12711111110x7F0o177Max signed 8-bit
255111111110xFF0o377Max unsigned 8-bit
5111111111110x1FF0o777Unix permission rwxrwxrwx
102311111111110x3FF0o1777Max 10-bit (ADC)

Hexadecimal is the most common shorthand for binary because each hex digit maps to exactly 4 binary bits — making conversion trivial. Octal maps 3 bits per digit and is primarily used for Unix file permissions (e.g., chmod 755 = 111 101 101 in binary = rwxr-xr-x).

Signed Binary Numbers (Two's Complement)

Computers represent negative numbers using two's complement — the standard defined by IEEE and used by virtually all modern processors. In an 8-bit two's complement system:

BinaryUnsigned DecimalSigned (Two's Complement)
0000000000
000000011+1
01111111127+127 (max positive)
10000000128−128 (min negative)
10000001129−127
11111110254−2
11111111255−1

To negate a number in two's complement: invert all bits and add 1. For example, +5 = 00000101 → invert → 11111010 → add 1 → 11111011 = −5.

The ranges for common integer types:

TypeBitsUnsigned RangeSigned Range
byte / uint880 to 255−128 to +127
short / int16160 to 65,535−32,768 to +32,767
int / int32320 to 4,294,967,295−2,147,483,648 to +2,147,483,647
long / int64640 to 18.4 × 10¹⁸−9.2 × 10¹⁸ to +9.2 × 10¹⁸

Binary in Everyday Technology

Binary is the foundation of all modern computing because transistors have two stable states (on/off, 1/0). Key applications:

Understanding binary directly helps in programming (bitwise operations, flags), networking (IP/subnet calculations), and working with low-level hardware.

Binary Arithmetic: Addition and Subtraction

Binary arithmetic follows the same rules as decimal, but with only two digits. The addition table is:

ABSumCarry
0000
0110
1010
1101

Example: 1011 + 0110

Working right to left: 1+0=1, 1+1=10 (write 0 carry 1), 0+1+1=10 (write 0 carry 1), 1+0+1=10 (write 0 carry 1). Result: 10001 (decimal: 11+6=17 ✓)

Subtraction in hardware is typically performed by adding the two's complement of the subtrahend. To compute A−B, the processor calculates A + (−B), where −B is the two's complement of B. This allows a single adder circuit to handle both addition and subtraction.

Bitwise Operations

Programming languages provide bitwise operators that manipulate individual bits. These are fundamental for low-level programming, embedded systems, and performance optimization:

OperationSymbolExample (8-bit)ResultUse Case
AND&10110101 & 1111000010110000Masking bits, extracting fields
OR|10110101 | 0000111110111111Setting bits, combining flags
XOR^10110101 ^ 1111111101001010Toggling bits, simple encryption
NOT~~1011010101001010Bit inversion
Left shift<<00000101 << 200010100Multiply by 2ⁿ
Right shift>>00010100 >> 200000101Divide by 2ⁿ

Bit shifting is significantly faster than multiplication/division in many processors. x << 1 is equivalent to x × 2, and x >> 1 is equivalent to x ÷ 2 (integer division). Game engines and embedded firmware use these operations extensively for performance.

Binary-Coded Decimal (BCD)

Binary-Coded Decimal represents each decimal digit using its own 4-bit binary pattern. Unlike pure binary, BCD preserves the decimal structure:

DecimalPure BinaryBCD
000000000
501010101
910011001
1010100001 0000
421010100100 0010
9911000111001 1001
255111111110010 0101 0101

BCD is less space-efficient than pure binary (10 of the 16 possible 4-bit combinations are used), but it simplifies decimal display — each nibble maps directly to a displayed digit. BCD is used in digital clocks, calculators, financial systems (where exact decimal representation matters), and older mainframe databases (COBOL, IBM EBCDIC).

Floating-Point Binary (IEEE 754)

Decimal numbers with fractional parts (like 3.14) are stored in binary using the IEEE 754 standard. A 32-bit (single-precision) float has three parts:

FieldBitsPurpose
Sign10 = positive, 1 = negative
Exponent8Biased exponent (bias = 127)
Mantissa (significand)23Fractional part (implicit leading 1)

Example: The decimal number −6.5 in IEEE 754 single-precision:

  1. Sign = 1 (negative)
  2. 6.5 in binary = 110.1₂ = 1.101 × 2² (normalized)
  3. Exponent = 2 + 127 (bias) = 129 = 10000001₂
  4. Mantissa = 10100000000000000000000 (23 bits, implicit leading 1 omitted)
  5. Full representation: 1 10000001 10100000000000000000000

This is why 0.1 + 0.2 ≠ 0.3 in most programming languages — the decimal fraction 0.1 has an infinite repeating representation in binary (like 1/3 in decimal = 0.333…), so it must be rounded, introducing tiny errors. For financial calculations, use decimal arithmetic libraries (Python's decimal module, Java's BigDecimal) instead of floating-point.

Character Encoding: From ASCII to UTF-8

Text is stored as binary numbers mapped to characters. The evolution of character encoding reflects the global expansion of computing:

EncodingYearBits per CharacterCharacters SupportedNotes
ASCII19637 (stored in 8)128English letters, digits, punctuation
Extended ASCII (ISO 8859-1)19878256Western European characters (é, ñ, ü)
UTF-819938–32 (variable)1,112,064Backward-compatible with ASCII; web standard
UTF-16199616–32 (variable)1,112,064Used in Java, Windows, JavaScript internal
UTF-32200032 (fixed)1,112,064Fixed width; wastes space for Latin text

UTF-8 encodes ASCII characters in a single byte (identical to plain ASCII), European characters in 2 bytes, CJK characters in 3 bytes, and emoji in 4 bytes. Over 98% of all web pages use UTF-8 encoding (per W3Techs, 2024).

Binary Logic Gates

Logic gates are the physical building blocks of all digital circuits. Each gate performs a simple binary operation on one or two input bits:

GateSymbolTruth Table (A,B → Output)Description
ANDA·B0,0→0; 0,1→0; 1,0→0; 1,1→1Output is 1 only when both inputs are 1
ORA+B0,0→0; 0,1→1; 1,0→1; 1,1→1Output is 1 when at least one input is 1
NOT¬A0→1; 1→0Inverts the input
NAND¬(A·B)0,0→1; 0,1→1; 1,0→1; 1,1→0AND followed by NOT — universal gate
XORA⊕B0,0→0; 0,1→1; 1,0→1; 1,1→0Output is 1 when inputs differ

The NAND gate is called a universal gate because any other logic function can be built using only NAND gates. Modern CPUs contain billions of transistors arranged into NAND and NOR gates, which are then combined into adders, multiplexers, flip-flops, and all the other building blocks of a processor. The Apple M3 chip contains approximately 25 billion transistors — each one a microscopic binary switch that is either on (1) or off (0).

The XOR gate has a special property: it outputs 1 when the two inputs are different. This makes it the foundation of binary addition (the sum bit of a half adder), error detection (parity checks), and simple encryption (XOR cipher).

History of Binary: From Leibniz to Modern Computing

The binary number system has a rich intellectual history:

YearPerson/EventContribution
~300 BCPingala (Indian mathematician)Used binary-like system to classify poetic meters
1679Gottfried LeibnizFormally described modern binary arithmetic; saw connections to Chinese I Ching
1847George BoolePublished "The Mathematical Analysis of Logic" — Boolean algebra foundation
1937Claude Shannon (MIT thesis)Showed Boolean algebra could model electrical switching circuits
1945John von NeumannProposed stored-program binary computer architecture (von Neumann architecture)
1971Intel 4004First commercial microprocessor — 2,300 transistors, 4-bit binary
2024Modern CPUsBillions of transistors; 64-bit binary architecture standard

Leibniz's insight that all numbers could be expressed using only 0 and 1 was purely mathematical — he never imagined electronic computers. Shannon's 1937 master's thesis connected Boolean (binary) logic to electrical relays, creating the theoretical foundation for all digital electronics. It has been called "possibly the most important master's thesis of the twentieth century."

Binary in Networking: IP Addresses and Subnet Masks

Understanding binary is essential for network administration. IPv4 addresses and subnet masks are 32-bit binary numbers:

DescriptionDotted DecimalBinary
IP address192.168.1.10011000000.10101000.00000001.01100100
Subnet mask (/24)255.255.255.011111111.11111111.11111111.00000000
Network address192.168.1.011000000.10101000.00000001.00000000
Broadcast address192.168.1.25511000000.10101000.00000001.11111111

The network address is calculated by ANDing the IP with the subnet mask. The broadcast address sets all host bits to 1. The number of usable host addresses = 2(32−prefix) − 2. For a /24 network: 2⁸ − 2 = 254 usable hosts.

Common subnet sizes:

CIDRSubnet MaskHostsTypical Use
/32255.255.255.2551Single host route
/30255.255.255.2522Point-to-point link
/24255.255.255.0254Standard LAN
/16255.255.0.065,534Large campus network
/8255.0.0.016,777,214Class A allocation

Frequently Asked Questions

How do I convert binary 1100 to decimal?

1100 in binary: 1×8 + 1×4 + 0×2 + 0×1 = 8 + 4 = 12. So binary 1100 = decimal 12.

What is 255 in binary?

255 in binary is 11111111 — all eight bits set to 1. This is the maximum value of a single byte and appears in networking (subnet mask 255.255.255.0) and color values (full red = 255, 0, 0).

How do I convert decimal 100 to binary?

Repeatedly divide by 2: 100÷2=50 R0, 50÷2=25 R0, 25÷2=12 R1, 12÷2=6 R0, 6÷2=3 R0, 3÷2=1 R1, 1÷2=0 R1. Reading remainders upward: 1100100₂. Verify: 64+32+4 = 100. ✓

What is the difference between binary and hexadecimal?

Binary uses base 2 (digits 0–1); hexadecimal uses base 16 (digits 0–9, A–F). Hex is compact shorthand for binary — each hex digit represents exactly 4 binary bits. For example, hex FF = binary 11111111 = decimal 255.

Why do computers use binary instead of decimal?

Electronic circuits are naturally binary: a transistor is either on (1) or off (0), and voltage is either high or low. Decimal would require 10 distinct voltage levels, which is difficult to implement reliably in hardware. Binary is noise-tolerant and maps perfectly to logical true/false operations.

What is two's complement?

Two's complement is the standard method for representing signed (positive and negative) integers in binary. To find the two's complement (negative) of a number: invert all bits and add 1. In an 8-bit system, +5 is 00000101, and −5 is 11111011. The leftmost bit is the sign bit: 0 = positive, 1 = negative. This system allows hardware to use the same adder circuit for both addition and subtraction.

How do I convert binary to hexadecimal?

Group the binary digits into sets of 4 from right to left, then convert each group. Example: 10110101₂ → 1011 0101 → B5₁₆. The groupings are: 0000=0, 0001=1, 0010=2, ..., 1001=9, 1010=A, 1011=B, 1100=C, 1101=D, 1110=E, 1111=F.

},{"@type":“Question”,“name”:“What is 255 in binary?”,“acceptedAnswer”:{"@type":“Answer”,“text”:“255 in binary is 11111111 — all eight bits set to 1. This is the maximum value of a single byte and appears in networking (subnet mask 255.255.255.0) and color values (full red = 255, 0, 0).”}},{"@type":“Question”,“name”:“Why do computers use binary instead of decimal?”,“acceptedAnswer”:{"@type":“Answer”,“text”:“Electronic circuits are naturally binary: a transistor is either on (1) or off (0). Decimal would require 10 distinct voltage levels, which is difficult to implement reliably in hardware.”}},{"@type":“Question”,“name”:“What is two’s complement?”,“acceptedAnswer”:{"@type":“Answer”,“text”:“Two’s complement represents negative numbers in binary. Invert all bits and add 1. It allows hardware to use the same adder circuit for both addition and subtraction.”}},{"@type":“Question”,“name”:“How do I convert binary to hexadecimal?”,“acceptedAnswer”:{"@type":“Answer”,“text”:“Group binary digits into sets of 4 from right to left, then convert each group: 0000=0, 0001=1, …, 1010=A, 1011=B, 1100=C, 1101=D, 1110=E, 1111=F.”}}]}