Home › Unit Converters › Decimal to Binary Converter
Decimal to Binary Converter
Convert decimal to binary with our free decimal to binary converter. Computers think in binary — strings of 0s and 1s — while people count in decimal, so students, programmers, and electronics learners constantly translate between the two. This tool converts between all four common number bases: binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16), in either direction. It uses exact BigInt arithmetic, so even numbers with dozens of digits convert perfectly. No sign-up, no download.
How to use this converter
- Type or paste the whole number in the Number box — for example, 255. Hex letters A–F are accepted when hex is the input base.
- Pick the base of your number under From base (decimal is selected) and the base you want under To base (binary is selected).
- Click Convert, or keep typing — the result updates live, and the line below it also shows the value in the other two bases.
- Use ⇄ Swap bases to reverse the direction, for instance to turn a binary string back into decimal.
Common amounts — the first sixteen numbers
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 3 | 11 | 3 | 3 |
| 4 | 100 | 4 | 4 |
| 5 | 101 | 5 | 5 |
| 6 | 110 | 6 | 6 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
How it works
A number base is simply a count of how many digit symbols a system uses before it rolls over. Decimal uses ten symbols (0–9), so the number after 9 is written 10 — one ten and no ones. Binary uses just two symbols (0 and 1), so it rolls over almost immediately: after 1 comes 10 (one two and no ones), then 11, then 100. Nothing about the value changes between bases — only the writing changes, the same way "ten" and "10" describe one quantity.
Converting decimal to binary by hand means asking, again and again, "is this number odd or even as I halve it?" Divide by 2, write the remainder (1 for odd, 0 for even), and repeat with the half until nothing is left. The remainders, read in reverse order, spell the binary number. Converting back, each binary digit is worth a power of two — 1, 2, 4, 8, 16, and so on from the right — and the decimal value is the sum of the places holding a 1.
Octal and hex earn their place because they are shortcuts for binary. Three binary digits always make exactly one octal digit, and four binary digits make exactly one hex digit, so programmers read long binary values in hex — FF is much friendlier than 11111111. That is why web colors are hex (#FF5733 is red 255, green 87, blue 51), why Unix permissions are octal (755 means rwxr-xr-x), and why memory addresses print in hex.
One technical point worth knowing: ordinary calculators and spreadsheets store numbers in a format that stays exact only up to 2⁵³ (about 9,007,199,254,740,992). Past that, digits silently round. This converter uses JavaScript's BigInt type instead, which keeps every digit exact for whole numbers of any length — try pasting a 40-digit number and converting it; the binary result will still be correct to the last 0 and 1.
Worked example
Priya, a first-year engineering student in Chennai, has to convert 255 to binary for a digital-electronics assignment — and show her working.
Step 1: Divide 255 by 2 repeatedly and note the remainders: 255 → 127 r1, 127 → 63 r1, 63 → 31 r1, 31 → 15 r1, 15 → 7 r1, 7 → 3 r1, 3 → 1 r1, 1 → 0 r1.
Step 2: Collect the remainders in order: 1, 1, 1, 1, 1, 1, 1, 1.
Step 3: Read them in reverse (here it makes no difference — all are 1s): 11111111.
Step 4: Read the result — 255 in decimal is 11111111 in binary.
Her teacher's cross-check also works: 11111111 has 1s in all eight places, and 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. The converter above gives the same answer instantly, along with octal 377 and hex FF — the three forms in which 255 appears in real systems every day.
FAQ
How do you convert decimal to binary by hand?
Keep dividing the number by 2 and note each remainder. The remainders, read from last to first, are the binary digits. For 255: it halves down with remainders 1,1,1,1,1,1,1,1, so 255 = 11111111 in binary.
What is 255 in binary?
255 is 11111111 in binary — eight 1s. That is why 255 appears so often in computing: it is the largest value one byte (8 bits) can hold, so colors, IP addresses, and subnet masks all top out at 255 per part.
How do I convert binary back to decimal?
Multiply each binary digit by its place value (powers of 2, starting from 1 on the right) and add the results. For 1010: 8 + 0 + 2 + 0 = 10. Or set the From list to Binary above and let the converter do it.
Can this converter handle very large numbers?
Yes. It uses BigInt arithmetic, which is exact for whole numbers of any length — far beyond the 15–16 digits ordinary calculators can handle. A 40-digit decimal number converts to binary with every digit correct.
What are octal and hex used for?
Octal (base 8) appears in Unix file permissions, where 755 and 644 are octal values. Hexadecimal (base 16) is the everyday shorthand for binary in computing — colors like #FF5733, memory addresses, and MAC addresses are all hex.
Why does the converter reject digits like 8 in binary or octal?
Each base only allows its own digits: binary uses only 0 and 1, octal uses 0–7, decimal 0–9, and hex 0–9 plus A–F. A digit outside the set has no meaning in that base, so the converter flags it instead of guessing.