Decimal to Binary Converter
Convert decimal numbers into binary representation instantly with step-by-step division methods and bit-level visualizations.
Binary Operands
Binary Number System
What Is the Binary Number System?
Binary is the base-2 numeral system that underpins every modern digital computer. Where decimal uses ten digits (0–9), binary uses just two — 0 and 1 — to represent every possible number. Each binary digit, or bit, corresponds to one of two electrical states (off or on, low or high voltage), which makes binary uniquely suited to the physics of transistors and the logic of digital circuits.
How Binary Works
Each bit in a binary number carries a place value that is a power of 2. The rightmost bit is 2⁰ = 1, the next is 2¹ = 2, then 4, 8, 16, 32, 64, 128, and so on. To convert any binary value to decimal, add the place values wherever a 1 appears. For example, 1011 = 8 + 0 + 2 + 1 = 11. This same place-value scheme — adapted from decimal — is what makes binary arithmetic so similar to the math you already know.
Why Computers Use Binary
Digital circuits reliably distinguish two voltage states but struggle with anything more nuanced. Mapping 0 and 1 to off/on gives modern hardware excellent noise tolerance, fast switching speeds, and a clean correspondence with Boolean algebra. Every higher-level abstraction — integers, floats, characters, images, audio, even neural-network weights — eventually compiles down to a stream of binary bits inside the CPU.
Four Ways to Use This Binary Calculator
Add binary numbers
Combine two binary values column-by-column with full carry handling. Useful for studying ALU adders, modeling overflow, or quickly summing register values.
Subtract & two's complement
Subtract one binary value from another and see how two's complement encodes negative numbers. Perfect for hands-on work with signed integer math.
Multiply via shift-and-add
See how binary multiplication reduces to a sequence of shifts and additions — the algorithm every CPU multiplier implements in silicon.
Long-divide & remainders
Perform binary long division with quotient and remainder, just like in elementary school but with only two outcomes per bit position.
Convert to hex & octal
Every result also displays in hexadecimal (base 16) and octal (base 8). Hex is preferred by programmers because 4 bits map cleanly to one hex digit.
Analyze bit storage
See exactly how many bits a value needs and which standard CPU width (8, 16, 32, 64 bits) it occupies — critical for embedded systems and protocol design.
Binary Arithmetic Rules at a Glance
Addition
0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 10 (carry 1) 1 + 1 + 1 = 11 (carry 1)
Subtraction (with borrow)
0 − 0 = 0 1 − 0 = 1 1 − 1 = 0 0 − 1 = 1 (borrow 1)
Multiplication
0 × 0 = 0 1 × 0 = 0 0 × 1 = 0 1 × 1 = 1
Division
Long division with two outcomes per step — the divisor either fits (write 1, subtract) or it doesn't (write 0, bring down). Same procedure as decimal long division, just simpler.
Bits, Bytes, and Storage Units
| Unit | Bits | Max Unsigned | Typical Use |
|---|---|---|---|
| Bit | 1 | 1 | Boolean flag, on/off switch |
| Nibble | 4 | 15 | Hex digit, BCD packed digit |
| Byte | 8 | 255 | ASCII char, RGB color channel, register byte |
| Word | 16 | 65,535 | Unicode BMP code point, audio sample |
| Doubleword | 32 | 4,294,967,295 | IPv4 address, default C int, RGBA color |
| Quadword | 64 | 18,446,744,073,709,551,615 | Pointer, timestamp, large counter |
Common Mistakes When Doing Binary Math
- Forgetting the carry. 1 + 1 in binary equals 10 (decimal 2), not 0 — and the carry must propagate to the next column.
- Confusing 0b and 0x prefixes. 0b101 means binary 101 (decimal 5); 0x101 means hex 101 (decimal 257).
- Treating signed and unsigned the same. An 8-bit value of 11111111 is 255 unsigned but −1 in two's complement signed.
- Off-by-one bit counts. An N-bit unsigned integer represents 2ᴺ distinct values, not 2ᴺ − 1.
- Ignoring overflow. Adding two 8-bit values can produce a 9-bit result; CPUs raise an overflow flag rather than silently truncating.
Frequently Asked Questions
Common Questions
What is a binary calculator?
A binary calculator performs arithmetic — addition, subtraction, multiplication, and division — directly on binary (base-2) numbers and shows the result in binary, decimal, hexadecimal, and octal. Our calculator also generates step-by-step solutions, a bit-by-bit visualization, and storage-size analysis so you can see exactly how the CPU would handle the calculation.
How do you add binary numbers?
Add column by column from right to left, exactly like decimal addition, but using only the rules 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 (write 0, carry 1), and 1 + 1 + 1 = 11 (write 1, carry 1). For example, 1010 + 1100 = 10110: rightmost bits 0 + 0 = 0, then 1 + 0 = 1, then 0 + 1 = 1, then 1 + 1 = 10 (write 0, carry 1), leaving a final 1 in the new high column.
How do you subtract binary numbers?
Computers subtract by adding the two's complement of the second operand. To compute A − B, invert every bit of B, add 1, then add that result to A. The carry out of the highest bit is discarded. This avoids needing dedicated subtraction hardware — the same adder handles both addition and subtraction.
How does binary multiplication work?
Binary multiplication uses the same shift-and-add method as long multiplication in decimal — but is dramatically simpler because every digit is 0 or 1. For each bit of the multiplier that is 1, copy the multiplicand shifted left by that bit's position; for each 0 bit, write zeros. Sum all the partial products to get the final binary product.
How is binary division performed?
Binary long division is the same as decimal long division but with only two outcomes per step: the divisor either fits into the current portion of the dividend (write a 1 and subtract) or it does not (write a 0 and bring down the next bit). The process continues until every bit of the dividend has been used. The leftover value is the remainder.
What is a bit, a nibble, and a byte?
A bit is a single binary digit — 0 or 1. A nibble is 4 bits and represents one hexadecimal digit. A byte is 8 bits and can represent 256 distinct values (0–255 unsigned, or −128 to 127 signed using two's complement). Most computer memory is addressed at the byte level, and all standard data types (int, float, char) are multiples of one byte.
Why do computers use binary instead of decimal?
Electronic circuits are reliable at distinguishing exactly two voltage states — high and low — which map directly to 1 and 0. Building a decimal computer would require detecting ten different voltage levels, which is both harder to engineer and far less noise-resistant. Binary also pairs perfectly with Boolean logic, the foundation of all digital circuits.
Can this calculator handle negative binary numbers?
Yes — prefix any binary input with a minus sign (e.g. -1010) and the calculator treats it as a signed value. Internally it uses arbitrary-precision BigInt arithmetic, so results stay exact even for numbers far larger than 64 bits. The bit-analysis panel reports the storage width a CPU would need to hold each result.
What is two's complement?
Two's complement is the standard encoding for signed integers in nearly every modern CPU. To represent a negative number in N bits, invert every bit of its magnitude and add 1. This makes the most significant bit the sign bit (1 = negative), gives exactly one representation for zero, and lets the same addition hardware handle both positive and negative operands.
How big a number can the calculator handle?
The calculator uses JavaScript BigInt, so there is no fixed bit limit — you can multiply two 200-bit numbers and the result is still exact. The result card always reports the actual bit length needed and rounds up to the nearest standard storage size (8, 16, 32, 64, or 128 bits) so you can see whether the answer would fit in an int8, int16, int32, or int64.
Binary Input
Binary to Decimal Conversion
How Binary-to-Decimal Conversion Works
Every binary number is a positional sum of powers of 2. The position of each digit determines its place value: 1, 2, 4, 8, 16, 32, 64, 128, 256, and so on, doubling at each position from right to left. To find the decimal equivalent of any binary number, multiply each digit by its place value and add the products.
The Place Value Method
Start at the rightmost bit and label each position with its power of 2. Write the bit multiplied by the place value below each column, then add. For 10101010: 128 + 32 + 8 + 2 = 170. This calculator's breakdown table renders this entire process automatically and highlights every contributing 1 bit.
Powers of Two to Memorize
2⁰=1, 2¹=2, 2²=4, 2³=8, 2⁴=16, 2⁵=32, 2⁶=64, 2⁷=128, 2⁸=256, 2⁹=512, 2¹⁰=1,024, 2¹¹=2,048, 2¹²=4,096, 2¹³=8,192, 2¹⁴=16,384, 2¹⁵=32,768, 2¹⁶=65,536. Most 8-bit conversions take seconds once these are in muscle memory.
Six Real-World Uses for Binary-to-Decimal Conversion
IPv4 Networking
Each octet of a 32-bit IPv4 address is a binary value 0–255. Network engineers convert binary subnets to decimal dotted form constantly.
Microcontroller Registers
ARM, AVR, and ESP datasheets show register layouts in binary. Decoding which bits to set or clear is a daily firmware task.
Bitmask Decoding
System-call flags, file permissions, and game-state bitmasks combine multiple boolean values into a single integer. Decoding requires bit-by-bit conversion.
Hex Color Codes
The hex color #FFA500 is 11111111 10100101 00000000 in binary — three bytes that decode to 255, 165, 0 in decimal RGB.
Hardware Debugging
Logic analyzers and oscilloscope traces capture raw binary. Converting to decimal makes the captured values comparable to source-code literals.
CS Education
Every introductory computer science course teaches binary-to-decimal conversion as the foundation for understanding all higher number systems.
Step-by-Step: Converting 11001100 to Decimal
- Step 1. Write each bit and its position: 1·2⁷ 1·2⁶ 0·2⁵ 0·2⁴ 1·2³ 1·2² 0·2¹ 0·2⁰
- Step 2. Multiply: 128 + 64 + 0 + 0 + 8 + 4 + 0 + 0
- Step 3. Sum: 128 + 64 = 192, then 192 + 8 = 200, then 200 + 4 = 204
- Result. 11001100₂ = 204₁₀ — the same value as the second operand in our reference calculator screenshot.
Decimal, Hexadecimal, and Octal — Why Three Bases?
Decimal is what humans read. Hex is what programmers prefer because every hex digit is exactly four bits, so reading a hex dump tells you the bit pattern at a glance. Octal grouped three bits per digit and was popular in early Unix file permissions (e.g. chmod 755) but has largely been replaced by hex. The conversion calculator shows all three at once so you can pivot between them as your task requires.
Frequently Asked Questions
Common Questions
How do you convert binary to decimal?
Multiply each binary digit by 2 raised to the power of its position (counting from the right starting at 0), then add the products. For example, 10101010 = 1·2⁷ + 0·2⁶ + 1·2⁵ + 0·2⁴ + 1·2³ + 0·2² + 1·2¹ + 0·2⁰ = 128 + 32 + 8 + 2 = 170. The calculator shows this expansion in an interactive place-value table.
What is the place-value method?
The place-value method assigns each binary digit a power of 2 based on its position. The rightmost bit has weight 2⁰ = 1, the next 2¹ = 2, then 4, 8, 16, 32, 64, 128, and so on. The decimal value of a binary number is the sum of the weights at every position where there is a 1 bit.
What does the binary number 1010 mean in decimal?
1010 in binary equals 10 in decimal: 1·2³ + 0·2² + 1·2¹ + 0·2⁰ = 8 + 0 + 2 + 0 = 10. The two 1 bits at positions 3 and 1 contribute 8 + 2 = 10. The calculator highlights exactly which bits contributed to the final value.
How do you convert a long binary number to decimal?
The same place-value method scales to any length — just keep going. For 16-bit and longer values, the calculator uses BigInt internally, so 32-bit and 64-bit binary strings still convert exactly without precision loss. You can paste a binary string with any number of digits.
Can I convert negative binary numbers to decimal?
Yes. Prefix the binary string with a minus sign (e.g. -1010) and the calculator treats it as a signed decimal value (−10 in this example). For true two's-complement decoding (where the leading bit is the sign), interpret the binary in the appropriate fixed width — the calculator notes the storage width in the analysis panel.
How is binary related to hexadecimal?
Hexadecimal is base-16 and packs exactly 4 binary bits per hex digit. The byte 10101010 splits into nibbles 1010 (A) and 1010 (A), giving the hex value AA. The calculator shows the hex equivalent of every binary input automatically, so you can switch between bases at a glance.
What is the largest binary number you can convert?
There is no fixed upper limit. The calculator parses binary strings into JavaScript BigInt, which supports arbitrary precision, so even thousand-bit binary numbers convert exactly. Useful for cryptography, hashing, and large-integer computer science problems.
Why does the decimal value start changing rapidly as the binary gets longer?
Each additional bit doubles the maximum value you can represent. Adding one digit to an 8-bit number (max 255) jumps the ceiling to 511 (9 bits) and then 1,023 (10 bits). This exponential growth is why doubling memory width quadruples or more the range of representable values.
Is there a shortcut for converting binary to decimal in your head?
Memorize the powers of 2 up to 1,024 (1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1,024). Then walk the binary number right-to-left and add up the powers where you see a 1. With practice you can convert 8-bit values in seconds.
Where is binary-to-decimal conversion used in real life?
Network engineers convert IP-address octets, firmware developers translate register values from datasheets, students convert encoded data in CS coursework, and game programmers decode bitmask flags. Anywhere a computer talks to humans, somebody is converting binary to decimal.
Decimal Input
Decimal to Binary Conversion
How Decimal-to-Binary Conversion Works
The standard method is repeated division by 2. Divide the decimal value by 2 and record the remainder. Divide the new quotient by 2 and record that remainder. Continue until the quotient reaches 0. The binary representation is the sequence of remainders read from bottom to top.
Repeated Division Method
This is the canonical textbook approach and the algorithm the calculator visualizes. It works because dividing by the base of the target system extracts one digit at a time from the least significant position upward. Each remainder is a base-2 digit by construction (0 or 1).
Subtract-Power-of-Two Method
Faster for mental conversion. Find the largest power of 2 less than or equal to the number, place a 1 in that column, subtract, and repeat. For 170: largest power ≤ 170 is 128 (2⁷), leaving 42; 32 (2⁵) leaves 10; 8 (2³) leaves 2; 2 (2¹) leaves 0. Bits at positions 7, 5, 3, 1 are 1: 10101010.
Six Real-World Uses for Decimal-to-Binary Conversion
Writing Bitmasks
Set the right bits in a CPU flag register, an I/O port, or a hardware mask by converting the desired decimal value into its binary bit pattern first.
Subnet Mask Design
A /24 subnet mask is 255.255.255.0 — four bytes whose binary form determines the network portion of an IP address.
Game Development
Encoding multiple boolean game-state flags (paused, muted, debug, hardcore) into a single integer is a binary representation trick used in every engine.
Embedded Firmware
Microcontroller initialization code constantly writes 8-, 16-, and 32-bit binary patterns to peripheral registers.
Encoding & Compression
Huffman coding, run-length encoding, and many other compression algorithms operate on the binary representation of source data.
Computer Science Coursework
Every algorithms and architecture class tests decimal-to-binary conversion. Knowing it cold accelerates everything else you learn.
Quick Reference: Decimal → Binary
| Decimal | Binary | Hex | Notable Use |
|---|---|---|---|
| 0 | 0 | 0 | False / null |
| 1 | 1 | 1 | True / set flag |
| 8 | 1000 | 8 | Lowest 4-bit power of 2 |
| 16 | 10000 | 10 | Hex base, nibble boundary |
| 64 | 1000000 | 40 | ASCII '@' |
| 127 | 1111111 | 7F | Max 7-bit value, max signed int8 |
| 128 | 10000000 | 80 | First 8-bit value, min signed int8 |
| 255 | 11111111 | FF | Max unsigned byte |
| 1024 | 10000000000 | 400 | 2¹⁰, KiB boundary |
| 65535 | 1111111111111111 | FFFF | Max unsigned word |
Storage Width Matters
A decimal that fits in 9 bits (e.g. 500 = 111110100) is stored in 16 bits by a CPU, because hardware sizes round up to standard word widths. The calculator's bit analysis dashboard reports both the raw bit count and the storage rounding so you can pick the right integer type for your code (int8, int16, int32, int64) without guessing.
Frequently Asked Questions
Common Questions
How do you convert decimal to binary?
Use the repeated-division-by-2 method: divide the decimal number by 2 and record the remainder (always 0 or 1). Repeat with the quotient until the quotient becomes 0. Then read the remainders from bottom to top — that sequence is the binary representation. The calculator displays every step in an interactive division table.
What is the binary of 170?
170 = 10101010 in binary. Divide 170 by 2 to get 85 r 0, then 85 by 2 = 42 r 1, then 42 by 2 = 21 r 0, then 21 by 2 = 10 r 1, then 10 by 2 = 5 r 0, then 5 by 2 = 2 r 1, then 2 by 2 = 1 r 0, then 1 by 2 = 0 r 1. Reading the remainders bottom-to-top gives 10101010.
What is the binary of 255?
255 = 11111111 in binary — eight 1 bits, the maximum value that fits in a single unsigned byte. Adding one more (256) requires a 9-bit representation: 100000000.
What is the binary of 1024?
1024 = 10000000000 in binary — a single 1 followed by ten 0s. Because 1024 = 2¹⁰, it is exactly the power-of-two boundary that defines a kibibyte (KiB) and the threshold where bit counts roll over to 11 bits.
Can I convert negative numbers to binary?
Yes. Enter a negative decimal (e.g. −170) and the calculator returns −10101010, a signed binary value. For true two's-complement encoding, the result depends on bit width — e.g. −1 in 8 bits is 11111111, but in 16 bits it is 1111111111111111. The analysis panel reports the storage width every result needs.
How do you convert a large decimal number to binary?
The repeated-division method works for any size. The calculator uses BigInt arithmetic, so even 100-digit decimal numbers convert exactly. The interactive division table renders the first dozen steps and summarizes the rest for very long conversions.
What is the fastest way to convert decimal to binary by hand?
Memorize powers of 2 (1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024) and use the subtraction method: find the largest power of 2 that fits, subtract it, place a 1 in that column, and repeat with the remainder. Any column you skip gets a 0. Most 8-bit values can be converted in under 10 seconds with practice.
Why does decimal-to-binary conversion always end?
Because dividing by 2 always reduces the number, eventually reaching 0. Every positive integer has a finite binary representation. For non-integer decimals the binary fraction can be non-terminating (e.g. 0.1 in binary is the repeating fraction 0.0001100110011…), which is why floating-point numbers are stored differently.
How is decimal to binary used in computer programming?
Programmers convert decimals to binary when working with bitwise flags, hardware registers, bitmasks, network protocols, and low-level memory layouts. C, Rust, and Python all let you write integer literals directly in binary (e.g. 0b10101010) so the binary form is preserved in source code.
What does the bit count tell me about storage?
The bit count is the minimum number of bits needed to represent that value, with no leading zeros. A CPU rounds up to the nearest standard width — 8, 16, 32, or 64 bits — so a value with a 9-bit count actually occupies 16 bits in memory. The calculator reports both the raw bit length and the storage size in bytes.