Binary Converter & Number Translator
Fast, accurate online binary converter. Convert between binary, decimal, hexadecimal, and octal with signed two's complement (-4, -7), IPv4 subnet mask to binary, and step-by-step calculation proofs.
All Base Representations
Signed Two's Complement Formats
Essential for negative numbers in binary (-4, -7, etc.)Step-by-Step Conversion Walkthrough
Division by 2 ProofComprehensive Guide to Binary Conversion
Binary is the bedrock of modern electronic computing, digital microprocessors, and network telecommunications. While humans calculate in decimal (base 10) because we evolved with ten fingers, computers communicate using silicon transistors that exist in two physical states: electrical voltage on (represented by 1) or electrical voltage off (represented by 0).
Whether you are developing software, analyzing network packets, configuring routing subnets, or debugging low-level memory, converting between binary, decimal, octal, and hexadecimal is an essential daily skill.
The Four Essential Number Systems
- Binary (Base 2): Uses only two symbols:
0and1. Each place value represents an ascending power of 2 ($2^0, 2^1, 2^2, 2^3 \dots$). - Octal (Base 8): Uses digits
0through7. Popular in Unix file permission strings (e.g. chmod 755). Each octal digit corresponds to exactly 3 binary bits. - Decimal (Base 10): The universal human counting system using digits
0through9. - Hexadecimal (Base 16): Uses digits
0–9and lettersA–F(where A=10, B=11, C=12, D=13, E=14, F=15). Each hex digit represents exactly 4 binary bits (one nibble).
Why Manual Conversion Causes Errors
Performing long division by 2 or positional power additions by hand is time-consuming and susceptible to simple arithmetic slips—especially when managing sign bits, two's complement carries, or 32-bit subnet octets.
Our free online binary converter eliminates human error by delivering instant, verified two-way conversions alongside full step-by-step mathematical proofs.
How to Convert Between Decimal and Binary Manually
Understand the two core mathematical algorithms used in computer science textbooks and technical exams:
Decimal to Binary (Successive Division by 2)
- Divide the integer decimal number by 2.
- Write down the integer quotient and the remainder (0 or 1).
- Repeat the division with the quotient until the quotient reaches 0.
- Read all remainders in reverse order (from bottom to top).
| Division | Quotient | Remainder |
|---|---|---|
| 21 ÷ 2 | 10 | 1 (LSB) |
| 10 ÷ 2 | 5 | 0 |
| 5 ÷ 2 | 2 | 1 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 (MSB) |
Binary to Decimal (Positional Weighting)
- Write down the binary digits from right to left.
- Assign an ascending power of 2 starting at $2^0 = 1$ for the rightmost bit.
- Multiply each binary bit by its corresponding power of 2.
- Sum all resulting products to get the decimal equivalent.
Negative Numbers in Binary: Two's Complement Explained
How do digital systems represent negative values like -4 in binary or -7 in binary? In digital hardware, circuits cannot store a literal minus sign ("-"). Instead, computers universally rely on two's complement notation.
-4 in Binary (8-bit Step-by-Step)
Keyword Target-
Start with +4 in 8-bit binary:
0000 0100 -
Invert every bit (One's Complement):
1111 1011 -
Add 1 to the inverted result:
1111 1011 + 1 = 1111 1100
11111111 11111100, and in hex it is 0xFC.
-7 in Binary (8-bit Step-by-Step)
Keyword Target-
Start with +7 in 8-bit binary:
0000 0111 -
Invert every bit (One's Complement):
1111 1000 -
Add 1 to the inverted result:
1111 1000 + 1 = 1111 1001
11111111 11111001, and in hex it is 0xF9.
11111100 represents -4 in 8-bit signed two's complement, but represents 252 in unsigned binary! Always verify the bit-width (8-bit, 16-bit, 32-bit, or 64-bit) when writing firmware or decoding network packets.
Subnet to Binary: IPv4 Subnet Masks in Networking
In IPv4 computer networking, every IP address consists of 32 bits divided into four 8-bit octets. A subnet mask tells routers which bits identify the network and which bits identify individual hosts.
| CIDR Prefix | Dotted Decimal Subnet Mask | 32-Bit Binary Octets | Usable IP Hosts |
|---|---|---|---|
| /30 | 255.255.255.252 | 11111111.11111111.11111111.11111100 | 2 |
| /29 | 255.255.255.248 | 11111111.11111111.11111111.11111000 | 6 |
| /28 | 255.255.255.240 | 11111111.11111111.11111111.11110000 | 14 |
| /26 | 255.255.255.192 | 11111111.11111111.11111111.11000000 | 62 |
| /24 | 255.255.255.0 | 11111111.11111111.11111111.00000000 | 254 |
| /16 | 255.255.0.0 | 11111111.11111111.00000000.00000000 | 65,534 |
Binary Code Translator: Reference Table (0 to 32)
Quick conversion lookup chart for Decimal, 8-Bit Binary, Hexadecimal, and Octal.
| Decimal | Binary (8-bit) | Hexadecimal | Octal |
|---|---|---|---|
| 0 | 00000000 | 0x0 | 0 |
| 1 | 00000001 | 0x1 | 1 |
| 2 | 00000010 | 0x2 | 2 |
| 3 | 00000011 | 0x3 | 3 |
| 4 | 00000100 | 0x4 | 4 |
| 5 | 00000101 | 0x5 | 5 |
| 6 | 00000110 | 0x6 | 6 |
| 7 | 00000111 | 0x7 | 7 |
| 8 | 00001000 | 0x8 | 10 |
| 9 | 00001001 | 0x9 | 11 |
| 10 | 00001010 | 0xA | 12 |
| 11 | 00001011 | 0xB | 13 |
| 12 | 00001100 | 0xC | 14 |
| 13 | 00001101 | 0xD | 15 |
| 14 | 00001110 | 0xE | 16 |
| 15 | 00001111 | 0xF | 17 |
| 16 | 00010000 | 0x10 | 20 |
| 17 | 00010001 | 0x11 | 21 |
| 18 | 00010010 | 0x12 | 22 |
| 19 | 00010011 | 0x13 | 23 |
| 20 | 00010100 | 0x14 | 24 |
| 21 | 00010101 | 0x15 | 25 |
| 22 | 00010110 | 0x16 | 26 |
| 23 | 00010111 | 0x17 | 27 |
| 24 | 00011000 | 0x18 | 30 |
| 25 | 00011001 | 0x19 | 31 |
| 26 | 00011010 | 0x1A | 32 |
| 27 | 00011011 | 0x1B | 33 |
| 28 | 00011100 | 0x1C | 34 |
| 29 | 00011101 | 0x1D | 35 |
| 30 | 00011110 | 0x1E | 36 |
| 31 | 00011111 | 0x1F | 37 |
| 32 | 00100000 | 0x20 | 40 |
Frequently Asked Questions (FAQ)
1111111111111100, and in 32-bit it is 11111111111111111111111111111100. To calculate it: take positive 4 (00000100), invert all bits to obtain 11111011 (one's complement), and add 1 to get 11111100.
Check Out Other Popular Tools
Portuguese Proficiency Test
Test your Portuguese level with our free adaptive CAPLE/CELPE-Bras assessment. Get an instant CEFR score (A1-C2) and PDF certificate.
SaaS LTV Calculator
Calculate Customer Lifetime Value (LTV) and Max Ad Spend (CAC) specifically for SaaS. Insights on churn, retention, and profitability.
Developer Typing Test (Code Syntax)
Test your real coding speed. Type actual code snippets in JS, Python, PHP, and CSS. Find out if your keyboard is holding you back.
Was this tool helpful?
Comments
Loading comments...