Decimal to Binary Converter

Convert a base-10 decimal number to base-2 binary. Enter a whole number to get the exact binary result, plus hexadecimal and octal equivalents.

Non-negative whole numbers only. Any number of digits is supported.

What is Decimal to Binary Conversion?

Decimal to binary conversion changes a base-10 number (digits 0-9) into its base-2 equivalent (only 0 and 1). Computers store and process all data in binary, so converting decimal to binary is the basis for understanding how a number is actually represented in memory.

For example, decimal 255 breaks down as (2×10²) + (5×10¹) + (5×10⁰). The same value in binary is 11111111, which is (1×2⁷) + (1×2⁶) + (1×2⁵) + (1×2⁴) + (1×2³) + (1×2²) + (1×2¹) + (1×2⁰). To convert the other direction, use the Binary to Decimal Converter. For arithmetic on binary values, see the Binary Calculator. For a broader look at how the two number systems compare, see binary vs decimal.

How to Convert Decimal to Binary Manually

The standard manual method is repeated division by 2:

Division-by-2 method

  1. Step 1: Divide the decimal number by 2.
  2. Step 2: Record the quotient and the remainder (0 or 1).
  3. Step 3: Divide the quotient by 2 again.
  4. Step 4: Repeat until the quotient reaches 0.
  5. Step 5: Read the remainders in reverse order (bottom to top) — that is the binary result.

Worked example: convert 42 to binary

42 ÷ 2 = 21 remainder 0
21 ÷ 2 = 10 remainder 1
10 ÷ 2 = 5  remainder 0
 5 ÷ 2 = 2  remainder 1
 2 ÷ 2 = 1  remainder 0
 1 ÷ 2 = 0  remainder 1

Reading remainders from bottom to top: 101010

Therefore, 42 in decimal = 101010 in binary

Manual division is useful for understanding the mechanics, but it is easy to drop a remainder on longer numbers — the converter above returns the exact result for any size of input. For a deeper walkthrough with more worked examples, the powers-of-two method, and common mistakes to avoid, see How to Convert Decimal to Binary.

Binary Place Value (Powers of Two)

Each binary digit (bit) represents a power of two based on its position, counting from the right starting at 2⁰. Summing the place values of every position holding a 1 gives the decimal equivalent — for example, 101010 has 1s in the 2⁵, 2³, and 2¹ positions: 32 + 8 + 2 = 42.

Power of 2Decimal Value
2⁰1
2¹2
2²4
2³8
2⁴16
2⁵32
2⁶64
2⁷128
2⁸256

Decimal to Binary Conversion Table

A quick reference for common decimal numbers and their binary, hexadecimal, and octal equivalents:

DecimalBinaryHexadecimalOctal
0000
1111
21022
410044
81000810
101010A12
151111F17
16100001020
31111111F37
321000002040
421010102A52
25511111111FF377
256100000000100400

Where Decimal to Binary Conversion Is Used

  • Computer science education: understanding how numbers map between bases is foundational before moving on to logic gates, data structures, and low-level programming.
  • Programming and debugging: bitwise operations, bit masks, and flag values are easier to reason about once a decimal value's binary form is visible.
  • Digital electronics: binary is the native representation for logic circuits, registers, and memory addressing.
  • Networking: IP addresses and subnet masks are groups of decimal octets that are easier to work with once expressed in binary. The Decimal to Hex Converter covers the related base-16 conversion used in areas like MAC addresses.

Negative Numbers and Two's Complement

This converter accepts zero and positive integers only. Simply writing a minus sign in front of a binary string (for example, -101010) isn't how computers represent negative numbers, and it isn't a fixed, unambiguous format on its own.

Machines represent negative numbers in binary using two's complement, which requires choosing a fixed bit width (such as 8, 16, or 32 bits) before the conversion makes sense. Use the Two's Complement Calculator to convert a negative decimal value into its signed binary representation at a specific bit width.

Frequently Asked Questions

How do I convert 42 to binary?

42 in decimal equals 101010 in binary. Dividing 42 by 2 repeatedly and reading the remainders bottom to top gives 1-0-1-0-1-0.

What is the binary equivalent of 0?

0 in decimal is 0 in binary — it is the same value in every base.

Can I convert negative numbers to binary?

Not directly here. Negative numbers need a fixed bit width and a signed format such as two's complement — use the Two's Complement Calculator for that.

Why does my binary result have so many more digits than the decimal number?

Binary is base-2, so it needs roughly 3.3 times as many digits as decimal (base-10) to represent the same value. For example, decimal 1000 requires 10 binary digits (1111101000).

What is the largest decimal number this tool can convert?

There is no fixed size limit. Conversion uses BigInt arithmetic, so arbitrarily large integers convert exactly rather than losing precision — unlike JavaScript's native Number type, which becomes inexact beyond 2^53 - 1 (9,007,199,254,740,991).

Can I convert a decimal fraction like 10.5?

No — this converter handles whole numbers only. Enter the integer part; binary fractions use a different representation than integer conversion produces.

What are the hexadecimal and octal results for?

They show the same value in base-16 and base-8, since both appear alongside binary in programming contexts such as memory addresses and file permissions.