Decimal to Binary Converter
Convert a decimal integer to binary, octal and hexadecimal with the division method shown. Example: with decimal number 156, the result is Binary = 10011100; Octal = 234; Hexadecimal = 9C.
Last updated · By S. Dilshan · Runs in your browser, nothing is uploaded
Step-by-Step Solution
How do you use the Decimal to Binary Converter?
Enter a non-negative whole number. The converter returns its binary, octal and hexadecimal forms, and the Step-by-Step Solution lists every division by 2 with its remainder, then reads the remainders from the bottom up to build the binary number. A final check converts the result back to decimal.
For negative numbers, see the two’s complement calculator, which shows how computers store signed values. For conversions between other bases, use the base converter on this site.
What formula does the Decimal to Binary Converter use?
To convert a whole number to binary, divide it by 2 repeatedly, write down the remainder each time (always 0 or 1) and stop when the quotient reaches 0. The binary number is the remainders read in reverse order, with the last remainder as the leading digit.
This works because each division by 2 peels off the lowest bit of the number. An equivalent method is to subtract the largest power of 2 that fits, mark that bit as 1, and continue with the remainder. Binary place values are 1, 2, 4, 8, 16, 32, 64, 128, and so on, doubling at each step to the left.
Worked example: 156
156 ÷ 2 = 78 remainder 0; 78 ÷ 2 = 39 remainder 0; 39 ÷ 2 = 19 remainder 1; 19 ÷ 2 = 9 remainder 1; 9 ÷ 2 = 4 remainder 1; 4 ÷ 2 = 2 remainder 0; 2 ÷ 2 = 1 remainder 0; 1 ÷ 2 = 0 remainder 1. Reading upwards gives 10011100. In hexadecimal, group the bits in fours: 1001 1100 = 9C. In octal, group in threes: 010 011 100 = 234. Check: 128 + 16 + 8 + 4 = 156.
Why computers use binary
Digital circuits have two stable states, on and off, so binary is the natural way to store and process information. Every number, letter, image and sound inside a computer is eventually a pattern of bits. Eight bits make a byte, which can hold 256 different values from 0 to 255.
Programmers use hexadecimal as a compact way to write binary, because each hex digit stands for exactly four bits. Binary knowledge helps with network masks, file permissions, colour codes and understanding why a signed 8-bit integer runs from −128 to 127.
What are the most common mistakes with the Decimal to Binary Converter?
- Reading the remainders from top to bottom instead of bottom to top.
- Stopping before the quotient reaches zero, which drops the leading bit.
- Confusing the binary number 10 with the decimal number ten. It equals two.
- Trying to convert fractions with the integer method. Fractional parts need repeated multiplication by 2.
What Is the Tested Example for the Default Values?
This example is computed by the same code that powers the calculator above, so you can compare it with your own numbers or a textbook answer.
| Input: Decimal number | 156 |
|---|---|
| Binary | 10011100 |
| Octal | 234 |
| Hexadecimal | 9C |
Where Can You Verify These Formulas?
The definitions and formulas on this page follow standard references. Check them against these sources:
Built and maintained by S. Dilshan. Found a mistake? Email [email protected] with the page address.
Frequently Asked Questions
How do you convert decimal to binary?
Divide by 2 repeatedly, record each remainder, then read the remainders from the last to the first.
What is 255 in binary?
11111111, which is eight ones and also FF in hexadecimal.
How does binary relate to hex?
Every group of four binary digits equals one hex digit, so converting between them is a regrouping.