Convert decimal to binary, exact for big numbers, with the divide-by-two steps
Type a decimal number and read its bits grouped in fours, with the divide-by-two steps written out and negative numbers as two’s complement.
How to use it
Type a whole number or a decimal fraction. Commas are fine: 1,000,000 reads as a million. Read its bits on top, grouped by four, and the division by 2 under it. For a negative number, pick the width in Bits to see the bits a computer stores.
Examples
A whole number
Input
156
Result
1001 1100
128 + 16 + 8 + 4 = 156
A negative number in 16 bits
Input
-5
Result
1111 1111 1111 1011
Bits: 16. Invert 0000 0000 0000 0101 and add 1.
How to convert decimal to binary by hand
Negative numbers: two’s complement
| Decimal | 8 bits | Hex |
|---|---|---|
-1 | 1111 1111 | ff |
-42 | 1101 0110 | d6 |
-128 | 1000 0000 | 80 |
127 | 0111 1111 | 7f |
Questions
- How do I convert a decimal fraction to binary?
Multiply the fraction by 2; the whole part (0 or 1) is the next bit, and you go on with what is after the point. 0.625 gives 1.25, 0.5, 1.0: 0.101. Some fractions never end, like 0.1, which repeats 0011 without end; the page shows that part in brackets. - How many bits does a number need?
As many as its binary digits: 255 needs 8, 256 needs 9. With Bits on Auto the page picks the smallest of 8, 16, 32, 64 and 128 that holds it, and says when it doesn’t fit the width you picked. - Can I type 5.72e2 or 1e-3?
Yes. On this page e-notation is read exactly: 5.72e2 is 572 and 1e-3 is 0.001, with exponents up to ±1000. On the number base converter in Auto, 1e3 is also a hex number (483), so it is read as hex and a line says what it would be as decimal. - Is the number I type uploaded?
No. Everything runs in your browser, so your numbers stay on your device. Nothing you paste is uploaded unless you share it.