Decimal to Binary Converter
Enter a decimal number to see it in binary, with every division by 2 and the hex and octal forms.
Free, no sign-upRuns in your browserHow we calculate
- Binary
- 10 1010
- Octal
- 52
- Decimal
- 42
- Hexadecimal
- 2A
- Bits needed
- 6
How this was calculated
- Divide by 2 repeatedly and write down each remainder; the remainders read from last to first are the binary digits.
- 42 ÷ 2 = 21 remainder 0
- 21 ÷ 2 = 10 remainder 1
- 10 ÷ 2 = 5 remainder 0
- 5 ÷ 2 = 2 remainder 1
- 2 ÷ 2 = 1 remainder 0
- 1 ÷ 2 = 0 remainder 1
- Read the remainders from bottom to top: 101010
How to convert decimal to binary
To convert a decimal number to binary, divide it by 2 again and again and write down each remainder. When the quotient reaches 0, read the remainders from the last one to the first: that string of 0s and 1s is the binary number. This decimal to binary converter performs the divisions and lists them, so you can copy the method into your notes.
Worked example
Convert 13. 13 ÷ 2 = 6 remainder 1; 6 ÷ 2 = 3 remainder 0; 3 ÷ 2 = 1 remainder 1; 1 ÷ 2 = 0 remainder 1. Reading the remainders from the bottom gives 1101. Check: 8 + 4 + 0 + 1 = 13. A larger value, 156, becomes 10011100 because 156 = 128 + 16 + 8 + 4.
The subtraction shortcut
You can also subtract powers of two. For 42, the largest power not above it is 32, leaving 10; then 8, leaving 2; then 2. The used powers are 32, 8 and 2, so the bits are 101010. Both methods give the same answer; division scales better for big numbers, subtraction is quicker in your head for values under 256.
Common mistakes
- Writing the remainders in the order you found them. They must be reversed.
- Stopping at a quotient of 1 and forgetting the final remainder of 1.
- Mixing up bits and bytes: a byte is 8 bits, so 13 is stored as 00001101 in one byte.
Related conversions
Change the target to hexadecimal to shorten the result: every 4 bits make one hex digit, so 11111111 is FF. For the reverse direction use binary to decimal, or hex to decimal for values from color codes and memory dumps. The tool handles whole numbers up to 200 digits; negative numbers are written with a minus sign, not in two's complement.
Frequently asked questions
How do you convert decimal to binary?
Divide the number by 2 repeatedly, noting each remainder, until the quotient is 0. Read the remainders from last to first. For 13: remainders 1, 0, 1, 1 read backwards give 1101.
What is 10 in binary?
1010. That is 8 + 2.
What is 255 in binary?
11111111, eight ones, because 255 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1.
How do you write a decimal number in hexadecimal?
Divide by 16 repeatedly and read the remainders backwards, using A–F for 10–15. Set the target to hexadecimal in this converter: 255 becomes FF.
How does binary store negative numbers?
Computers usually use two's complement. This converter writes a minus sign in front of the binary magnitude instead, so -10 shows as -1010.