The method
To convert a decimal number to binary, divide it by 2 again and again. Write down each remainder, which is always 0 or 1, and stop when the quotient reaches 0. Then read the remainders from the last to the first.
13 / 2 = 6 remainder 1
6 / 2 = 3 remainder 0
3 / 2 = 1 remainder 1
1 / 2 = 0 remainder 1
Read upward: 1101The working table above lists every division, so you can follow or check your homework.
Bit width
Choose a width to pad the result with zeros to 8, 16, 32 or 64 bits, as a byte, a short or an integer would be stored. Leave it on Minimal for the shortest form. An 8-bit field holds 0 to 255 unsigned, or -128 to 127 signed.
Negative numbers
With a width chosen, negative numbers are shown in two's complement. The method is: write the positive number in binary, flip every bit, then add 1. For -5 in 8 bits: 5 is 00000101, flipped is 11111010, plus 1 is 11111011. The tool shows these three steps. With Minimal width, a negative number is shown as a minus sign and the binary of its size.
Common values
- 8 is 1000
- 10 is 1010
- 64 is 1000000
- 255 is 11111111
- 256 is 100000000
Paste a list of decimal numbers in the batch box to convert many at once.
To go back, use binary to decimal. For hexadecimal, see binary to hex. Start from the basics with the guide to binary numbers.