Decimal to Binary Converter

Convert decimal numbers into binary representation instantly with step-by-step division methods and bit-level visualizations.

Decimal Input

Supports arbitrarily large integers.
Quick examples:

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

1

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.

2

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.

3

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.

4

Embedded Firmware

Microcontroller initialization code constantly writes 8-, 16-, and 32-bit binary patterns to peripheral registers.

5

Encoding & Compression

Huffman coding, run-length encoding, and many other compression algorithms operate on the binary representation of source data.

6

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

DecimalBinaryHexNotable Use
000False / null
111True / set flag
810008Lowest 4-bit power of 2
161000010Hex base, nibble boundary
64100000040ASCII '@'
12711111117FMax 7-bit value, max signed int8
1281000000080First 8-bit value, min signed int8
25511111111FFMax unsigned byte
1024100000000004002¹⁰, KiB boundary
655351111111111111111FFFFMax 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.