How to Convert Between Binary, Decimal and Hexadecimal

Computers count in binary, people count in decimal, and programmers often write values in hexadecimal. Converting between these bases is a basic skill for anyone learning computing. This guide shows you the methods by hand, with worked examples.

The three bases at a glance

Decimal uses ten digits, 0 to 9, and each position is worth ten times the one to its right. Binary uses two digits, 0 and 1, and each position doubles. Hexadecimal uses sixteen symbols, 0 to 9 plus A to F, where A is 10 and F is 15. Each hex digit is worth exactly four binary digits, which is why programmers like it.

Binary to decimal, step by step

Take 1011. Write the place values above the digits, from the right: 1, 2, 4, 8. Multiply each digit by its place value and add: 1 times 8 plus 0 times 4 plus 1 times 2 plus 1 times 1 equals 11. So 1011 in binary is 11 in decimal.

Decimal to binary, step by step

Take 13. Divide by 2 and write down the remainder each time: 13 divided by 2 is 6 remainder 1; 6 divided by 2 is 3 remainder 0; 3 divided by 2 is 1 remainder 1; 1 divided by 2 is 0 remainder 1. Read the remainders from bottom to top: 1101. So 13 in decimal is 1101 in binary.

Using hexadecimal as a shortcut

Group binary digits in fours from the right, then turn each group into one hex digit. For example, 11110101 splits into 1111 and 0101, which are F and 5, so the hex value is F5. To go back, expand each hex digit into four binary digits. To convert decimal to hex, divide by 16 instead of 2 and read the remainders upward, using A to F for remainders 10 to 15.

Common mistakes

  • Reading binary place values left to right instead of right to left.
  • Forgetting to pad the leftmost group with zeros when grouping by four.
  • Mixing up the letters: B is 11, C is 12, D is 13, E is 14, F is 15.

Try it the faster way

The tool below converts between bases instantly, so you can check your hand calculations.

Prefer the full page? Open the base converter directly.

Quick tips

  • Learn the first sixteen hex values by heart: 0 to 9, then A to F.
  • Check any conversion by converting back to the starting base.
  • For long binary strings, always group from the right, not the left.

Once the place-value idea clicks, every base works the same way. Only the number of digits changes.

Frequently asked questions

Why do programmers use hexadecimal at all? Because one hex digit maps exactly to four binary digits, so long binary strings become short and readable. A 32-bit value needs 32 binary digits but only 8 hex digits. Colors, memory addresses, and error codes are all easier to read in hex.

How do I convert a large decimal number to binary quickly? Use the divide-by-2 method and write remainders in a column, then read them bottom to top. For very large numbers, convert to hex first by dividing by 16, then expand each hex digit into four binary digits. The two-step route has fewer steps and fewer chances to slip.

What is the difference between a bit and a byte? A bit is one binary digit, 0 or 1. A byte is eight bits, which can hold values from 0 to 255. Two hex digits describe exactly one byte, which is another reason hex is popular in computing.

Worked example

Convert decimal 42 to binary and hex. Divide by 2 repeatedly: 42 gives 21 remainder 0, 21 gives 10 remainder 1, 10 gives 5 remainder 0, 5 gives 2 remainder 1, 2 gives 1 remainder 0, 1 gives 0 remainder 1. Read the remainders bottom to top: 101010. For hex, divide by 16: 42 gives 2 remainder 10, and 10 is A, so the result is 2A. Check by grouping the binary into fours from the right: 0010 1010 becomes 2 and A. Both routes agree, which is exactly the cross-check you want.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top