Developer utility · decimal to binary converter
Decimal to Binary Converter
Convert a non-negative decimal integer to binary and other common bases. The result includes the repeated-division steps used to reach the binary form, so you can verify the answer instead of treating the converter as a black box.
Up to 4,096 characters. No value is sent to a server.
Your conversion results will appear here.
Choose an input format, enter a value and select Convert to see binary, decimal, hex, octal and text results.
Use the tool
How to use this converter
- 1
Keep Decimal selected, or choose another input format.
- 2
Enter a non-negative whole number and select Convert.
- 3
Read the remainders from bottom to top, or copy the binary result.
Understand the result
How it works
Decimal to binary conversion repeatedly divides the integer by 2 and records each remainder. The quotient becomes the next value to divide. Once it reaches zero, reading the remainders from the last row back to the first gives the binary representation. For 42, the remainders are 0, 1, 0, 1, 0, 1 from top to bottom, so the result is 101010. The special case 0 remains 0 because it has no non-zero quotient to divide.
Practical notes
How to convert decimal to binary by hand
The repeated-division method works because division by the target base separates the least-significant digit from the remaining quotient. Divide 42 by 2 to get 21 remainder 0; divide 21 by 2 to get 10 remainder 1; continue until the quotient is 0. The first remainder is the rightmost binary digit, which is why the list is read upward at the end.
For a second check, add the powers of two represented by the 1s. In 101010, the 1s are in the 2⁵, 2³ and 2¹ positions: 32 + 8 + 2 = 42. Both methods should agree.
Practical notes
Integer output and byte output are different
The shortest binary form is used for the integer result, so 42 is shown as 101010 rather than 00101010. When the value represents text or a byte, leading zeroes carry information and should be kept: the byte for `*` is 00101010. Use Text input or group a binary value into eight-bit bytes when byte boundaries matter.
This page accepts whole numbers only. Decimal fractions, negative values and scientific notation are reported as unsupported instead of being rounded or silently changed.
- Use decimal-to-binary for non-negative integers.
- Use Text to Binary when the source is a word, sentence or Unicode character.
- Use Binary to Decimal when you already have a bit string and need its integer value.
Quick reference
Examples
42
101010
42 ÷ 2 remainders read upward
255
11111111
Eight binary digits
13
1101
8 + 4 + 1
Common questions
FAQ
How is decimal converted to binary?
Divide by 2 until the quotient is zero, record each remainder, then read the remainders from the last one back to the first.
Are decimal fractions supported?
No. This page accepts non-negative integers only and reports decimals or scientific notation as unsupported.
Can I convert a very large decimal integer?
Yes. The converter uses BigInt rather than floating-point Number arithmetic.
Why are the remainders read from bottom to top?
Each remainder is the next digit from the right, starting with the least-significant bit. Reversing the remainder list puts the most-significant bit first.
Should decimal 42 be written as 00101010 in binary?
The integer result is the shortest form, 101010. Add leading zeroes only when you need a fixed-width byte or another defined bit width.
