Decimal to Binary Converter
Convert any decimal (base-10) number to binary (base-2) instantly. Binary is the foundation of all digital computing — understanding how decimal maps to binary is essential for every programmer.
Common Values
| Input | Binary |
|---|---|
| 1 | 1 |
| 2 | 10 |
| 4 | 100 |
| 7 | 111 |
| 8 | 1000 |
| 10 | 1010 |
| 15 | 1111 |
| 16 | 10000 |
| 32 | 100000 |
| 42 | 101010 |
| 64 | 1000000 |
| 100 | 1100100 |
| 127 | 1111111 |
| 128 | 10000000 |
| 255 | 11111111 |
| 256 | 100000000 |
| 512 | 1000000000 |
| 1000 | 1111101000 |
| 1024 | 10000000000 |
| 65535 | 1111111111111111 |
How It Works
To convert a decimal number to binary, repeatedly divide by 2 and record the remainders. Reading the remainders from bottom to top gives the binary representation. For example, converting 13: 13÷2=6 R1, 6÷2=3 R0, 3÷2=1 R1, 1÷2=0 R1 — reading remainders upward gives 1101. Each binary digit represents a power of 2: the rightmost is 2⁰ (1), next is 2¹ (2), then 2² (4), and so on. Any decimal number can be uniquely expressed as a sum of distinct powers of 2.
Worked Examples
| Decimal | Binary |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 10 |
| 7 | 111 |
| 8 | 1000 |
| 10 | 1010 |
| 15 | 1111 |
| 16 | 10000 |
| 42 | 101010 |
| 127 | 1111111 |
Related Conversions
Frequently Asked Questions
- How do I convert a decimal number to binary?
Repeatedly divide the decimal number by 2, recording each remainder (0 or 1). After dividing until the quotient is 0, read the remainders from bottom to top to get the binary number.
- What is 255 in binary?
255 in binary is 11111111. It represents 8 bits all set to 1, which is the maximum value of a single unsigned byte.
- Why is binary important in computing?
Computers use binary because electronic circuits have two stable states: on (1) and off (0). Every piece of data — images, text, programs — is ultimately stored and processed as binary.
- How many binary digits does a decimal number need?
A decimal number n requires ⌊log₂(n)⌋ + 1 binary digits. For example, 255 needs 8 digits (11111111), while 256 needs 9 (100000000).