What is Binary?
Binary is a base-2 number system that uses only two digits: 0 and 1. While humans count in base 10 (using digits 0–9), computers use binary because electronic circuits can easily represent two states: on (1) and off (0).
How to Convert Binary to Decimal
Each position in a binary number represents a power of 2, starting from the right (2^0 = 1, 2^1 = 2, 2^2 = 4, 2^3 = 8, and so on). To convert, multiply each digit by its position value and add them all up.
Example: 1011 in binary
- 1 × 2^3 = 8
- 0 × 2^2 = 0
- 1 × 2^1 = 2
- 1 × 2^0 = 1
- Total: 8 + 0 + 2 + 1 = 11 in decimal
How to Convert Decimal to Binary
Divide the number by 2 repeatedly and record the remainders. Read the remainders from bottom to top.
Example: 13 in decimal
- 13 ÷ 2 = 6 remainder 1
- 6 ÷ 2 = 3 remainder 0
- 3 ÷ 2 = 1 remainder 1
- 1 ÷ 2 = 0 remainder 1
- Read bottom to top: 1101
Common Binary Values to Memorize
- 0000 = 0 0001 = 1 0010 = 2 0011 = 3
- 0100 = 4 0101 = 5 0110 = 6 0111 = 7
- 1000 = 8 1001 = 9 1010 = 10 1111 = 15
- 11111111 = 255 (8 bits / 1 byte max)
Use our free binary converter to convert between decimal, binary, hex and octal instantly.
Step-by-Step Conversion Examples
Understanding IPv4 Addresses in Binary
Every IP address on the internet is stored as four 8-bit binary numbers. The address 192.168.1.1 breaks down as:
- 192 = 11000000 in binary (128+64 = 192)
- 168 = 10101000 in binary (128+32+8 = 168)
- 1 = 00000001
- 1 = 00000001
Each octet must stay within 0–255 because that's the maximum value of 8 bits (2⁸ − 1 = 255). This is why IP addresses can never contain a number above 255 — it would require more than one byte. A /24 subnet mask (255.255.255.0) = 11111111.11111111.11111111.00000000 in binary.
ASCII: How Text is Stored as Binary
Every character you type is stored as a binary number. In ASCII encoding:
- The letter "A" = 65 decimal = 01000001 binary
- The letter "a" = 97 decimal = 01100001 binary
- The digit "0" = 48 decimal = 00110000 binary
- A space = 32 decimal = 00100000 binary
Verification: 01000001 = 0+64+0+0+0+0+0+1 = 65 = "A" ✓
The difference between uppercase "A" (65) and lowercase "a" (97) is exactly 32 — the value of bit 5. Toggling bit 5 switches between upper and lowercase for any ASCII letter. Modern systems use UTF-8, which is backward-compatible with ASCII for all characters below 128.
Converting a 16-Bit Value
In computing, 16-bit values are common — integers, audio samples, port numbers. Let's convert binary 1100101000111110 to decimal:
- Group into nibbles: 1100 / 1010 / 0011 / 1110
- Active bits (left to right): 2¹⁵, 2¹⁴, 2¹⁰, 2⁹, 2⁵, 2⁴, 2³, 2², 2¹
- = 32768 + 16384 + 1024 + 512 + 32 + 16 + 8 + 4 + 2 = 50,750 decimal
This same value is representable as 0xCA3E in hexadecimal (C=12, A=10, 3=3, E=14) — one hex digit per 4 bits. This is why programmers prefer hex for reading binary values larger than one byte.
Negative Numbers: Two's Complement
CPUs don't store negative numbers as "minus sign + value." They use two's complement: flip all bits, then add 1. For −13 in 8-bit signed representation:
- Start with +13 = 00001101
- Flip all bits (one's complement): 11110010
- Add 1: 11110011
- Result: 11110011 = −13 in two's complement
Verification: 11110011 as unsigned = 128+64+32+16+2+1 = 243. As signed: 243 − 256 = −13 ✓
This is why signed 8-bit integers range from −128 to +127, not 0–255. The highest bit acts as the sign bit: 0 = positive, 1 = negative. A signed 8-bit −128 = 10000000 has no positive equivalent within the same range (128 doesn't fit), making it an asymmetric range.
Source: IEEE 754 floating-point standard; Unicode Consortium UTF-8 specification. Last verified: May 2026.
Frequently Asked Questions
How do I convert binary to decimal by hand?
Write down each binary digit and multiply it by its positional value (powers of 2 from right to left: 1, 2, 4, 8, 16...). Add up the results. Example: 1101 = (1×8) + (1×4) + (0×2) + (1×1) = 8+4+0+1 = 13. Our converter handles this instantly for any size number.
Why do computers use binary?
Computers use binary because electronic circuits naturally operate in two states: on (1) or off (0). Using a two-state system makes hardware simpler, more reliable, and less error-prone than trying to represent ten distinct voltage levels for a decimal system. Every program, image, and file on your computer is ultimately stored as binary.
What is the largest number you can represent with 8 bits?
With 8 bits (one byte), you can represent numbers from 0 to 255 (2⁸ − 1 = 255). For signed integers (positive and negative), the range is −128 to +127. This is why IPv4 addresses have values from 0 to 255 in each octet — each octet is exactly one byte.
Convert between decimal, binary, hexadecimal, and octal instantly.
⚡ Binary & Number Systems Converter — FreeAccuracy note: Conversion factors on SwiftConvertHub are sourced from NIST and IEC standards. Results are accurate for general use. For safety-critical or professional applications, verify results independently. Full disclaimer →
Victor A. Calvo S. is a software engineer and digital entrepreneur who builds practical, free tools for developers, students, and professionals worldwide. He is the creator of SwiftConvertHub, InstantLinkHub, and Feexio. All conversion factors are cross-referenced against NIST and IEC standards. Learn more →