Decimal to Binary Converter - Convert Numbers to Binary
—————Turn Any Whole Number Into Binary
Enter a decimal number and its binary form appears at once. Tick "Group digits" to pad the result to whole 4-bit nibbles and split it with spaces, which makes long values much easier to check against a datasheet. The hex and octal equivalents are listed too. Large numbers such as 264 or a database ID with 20 digits convert exactly.
The Divide-by-Two Method
To convert by hand, divide by 2 over and over and keep the remainders. Each remainder is one bit, starting with the least significant bit on the right.
Worked example: 156
| Number | ÷ 2 | Remainder (bit) |
|---|---|---|
| 156 | 78 | 0 |
| 78 | 39 | 0 |
| 39 | 19 | 1 |
| 19 | 9 | 1 |
| 9 | 4 | 1 |
| 4 | 2 | 0 |
| 2 | 1 | 0 |
| 1 | 0 | 1 |
Reading the remainders from the bottom up gives 10011100. Check it by adding the place values of the 1 bits: 128 + 16 + 8 + 4 = 156.
An alternative is subtraction: find the largest power of two that fits (128), write a 1 in that position, subtract it (28 left), and repeat with 16, 8 and 4. Positions you skip get a 0.
Decimal to Binary Table
| Decimal | Binary | Grouped |
|---|---|---|
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 2 | 10 | 0010 |
| 3 | 11 | 0011 |
| 4 | 100 | 0100 |
| 5 | 101 | 0101 |
| 6 | 110 | 0110 |
| 7 | 111 | 0111 |
| 8 | 1000 | 1000 |
| 9 | 1001 | 1001 |
| 10 | 1010 | 1010 |
| 11 | 1011 | 1011 |
| 12 | 1100 | 1100 |
| 13 | 1101 | 1101 |
| 14 | 1110 | 1110 |
| 15 | 1111 | 1111 |
| 16 | 10000 | 0001 0000 |
| 17 | 10001 | 0001 0001 |
| 18 | 10010 | 0001 0010 |
| 19 | 10011 | 0001 0011 |
| 20 | 10100 | 0001 0100 |
| 32 | 100000 | 0010 0000 |
| 50 | 110010 | 0011 0010 |
| 64 | 1000000 | 0100 0000 |
| 100 | 1100100 | 0110 0100 |
| 127 | 1111111 | 0111 1111 |
| 128 | 10000000 | 1000 0000 |
| 200 | 11001000 | 1100 1000 |
| 255 | 11111111 | 1111 1111 |
| 256 | 100000000 | 0001 0000 0000 |
| 512 | 1000000000 | 0010 0000 0000 |
| 1000 | 1111101000 | 0011 1110 1000 |
| 1024 | 10000000000 | 0100 0000 0000 |
Bit Width and Leading Zeros
The binary form of a number has no fixed length: 5 is simply 101. Real systems store numbers in fixed widths, so 5 in an 8-bit byte is written 00000101 and in a 16-bit register 0000000000000101. The extra zeros on the left do not change the value. When you compare against documentation that shows full bytes or words, pad the result on the left to the width you need. The grouping option pads to whole nibbles, which lines the result up with hex digits.
To check an answer, add up the place values of each 1 bit, or convert the result back with the binary to decimal page and confirm you get the original number.
Why Developers Convert to Binary
Seeing the bits helps when you build bit masks, set feature flags, check which permissions a number enables, or work out a subnet mask from a prefix length. To read binary back as a number, use the binary to decimal converter. To turn text characters into bits, use the text to binary mode of the hex converter.
Related Tools
JWT Decoder
Decode JSON Web Tokens and inspect header, payload and signature.
Base64 Encode / Decode
Encode text to Base64 or decode Base64 strings back to plain text.
URL Encode / Decode
Percent-encode or decode URLs and query-string parameters safely.
Hash Generator
Generate MD5, SHA-1, SHA-256, SHA-384, and SHA-512 hashes from text.