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.
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
- Step 1: Divide the decimal number by 2.
- Step 2: Record the quotient and the remainder (0 or 1).
- Step 3: Divide the quotient by 2 again.
- Step 4: Repeat until the quotient reaches 0.
- 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 2 | Decimal 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:
| Decimal | Binary | Hexadecimal | Octal |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 4 | 100 | 4 | 4 |
| 8 | 1000 | 8 | 10 |
| 10 | 1010 | A | 12 |
| 15 | 1111 | F | 17 |
| 16 | 10000 | 10 | 20 |
| 31 | 11111 | 1F | 37 |
| 32 | 100000 | 20 | 40 |
| 42 | 101010 | 2A | 52 |
| 255 | 11111111 | FF | 377 |
| 256 | 100000000 | 100 | 400 |
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.
Related Converters
Binary to Decimal
Convert binary numbers back to decimal — the reverse of this tool.
Binary Calculator
Add, subtract, multiply, and divide binary numbers.
Decimal to Hex
Convert decimal numbers to hexadecimal notation.
Two's Complement Calculator
Represent negative numbers in binary at a fixed bit width.
Binary to Hex
Convert binary numbers to hexadecimal notation.
Octal to Binary
Convert octal numbers to binary — useful for Unix file permissions.
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.
Related Tools
You might also find these tools useful
Base Converter
Convert whole numbers between binary, octal, decimal, hex, and custom bases 2-36 in one hub.
Binary Converter
Convert text, UTF-8 bytes, and binary values without focusing only on readable messages.
Binary Calculator
Add, subtract, multiply, and divide binary numbers for math and computer science exercises.
Binary to Decimal
Turn base-2 numbers into decimal values for programming, networking, and study notes.
Binary to HEX
Compress long binary strings into hexadecimal groups for code, memory, and color checks.
Decimal to HEX
Translate decimal values into compact hexadecimal notation for technical references.