This article will explain how to convert binary (base 2) to hexadecimal (base 16). Whether it is for coding, for math class, or for The Martian, hexadecimal is useful and powerful shortcut when writing long binary strings. Since both bases are powers of 2, this procedure is much simpler than general conversions such as converting decimal to binary. All you need are basic adding and counting skills to make turn a binary number into hexadecimal.

Steps

Sample Converter

Method1

Making Basic Conversions

1

Find a line of up to four binary numbers to convert. Binary numbers can only be 1 and 0. Hexadecimal numbers can be 0-9, or A-F, since hexadecimal is base-16. You can convert any binary string to hexadecimal (1, 01, 101101, etc.), but you need four numbers to make the conversion (0101→5; 1100→C, etc.). For this lesson, start with the example 1010.

1010

If you don't have 4 digits, add zeros to the front to make it four digits. So, 01 would become 0001.[1]

2

Write a small "1" above the last digit. Each of the four numbers signifies a type of number decimal system number. The last digit is the one's place. You will make sense of the rest of the digits in the next step. For now, write a small one above the last digit.[2]

1010

10101{\displaystyle 1010^{1}}

Note that you are not raising anything to any power -- this is just a way to see what digit means what.

3

Write a small "2" above the third digit, a "4" above the second, and an "8" above the first. These are the rest of your place holders. If you're curious, this is because each digit represents a different power of 2. The first is 23{\displaystyle 2^{3}}, the second 22{\displaystyle 2^{2}}, etc.

1010

18041201{\displaystyle 1^{8}0^{4}1^{2}0^{1}}

4

Count out how many of each "place" you have. Luckily, this conversion is easy once you have four numbers and know what they all mean. If you have a one in the first number, you have one eight. If you have a zero in the second column, you have no fours. The third column tells you how many twos, and the second how many ones. So, for our example:[3]

1010

18041201{\displaystyle 1^{8}0^{4}1^{2}0^{1}}

8 0 2 0

5

Add your four numbers together. Once you have your new hexadecimal numbers, simply add them up.

1010

18041201{\displaystyle 1^{8}0^{4}1^{2}0^{1}}

8 0 2 0

8+0+2+0=10{\displaystyle 8+0+2+0=10}

Final answer: The binary number 1010 converts to A in the hexadecimal system.

6

Change any number above "9" into a letter. This is so you don't get confused when reading hexadecimal ("is that a 1 and a 5, or a 15?"). Luckily, the system is super easy, since you can't have a hexadecimal number bigger than 15. Simply start the alphabet with 10, so that:

10=A{\displaystyle 10=A}

11=B{\displaystyle 11=B}

12=C{\displaystyle 12=C}

13=D{\displaystyle 13=D}

14=E{\displaystyle 14=E}

15=F{\displaystyle 15=F}

7

Try a few examples to get better at converting. The following examples have answers in white beneath them. To see the work and the answers, highlight the area under the question by clicking and dragging your mouse over it.

Convert 1 to hexadecimal.

Add zeros to get four digits: 0001

Find your place holders:08040211{\displaystyle 0^{8}0^{4}0^{2}1^{1}}

Add up the digits:0+0+0+1=1{\displaystyle 0+0+0+1=1}

Final answer: 1

Convert 0101 to hexadecimal.

Add zeros to get four digits: 0101

Find your place holders:08140211{\displaystyle 0^{8}1^{4}0^{2}1^{1}}

Add up the digits:0+4+0+1=5{\displaystyle 0+4+0+1=5}

Final answer: 5

Convert 1110 to hexadecimal.

Add zeros to get four digits: 1110

Find your place holders:18141201{\displaystyle 1^{8}1^{4}1^{2}0^{1}}

Add up the digits:8+4+2+0=14{\displaystyle 8+4+2+0=14}

Final answer: E

Convert 0011 to hexadecimal.

Add zeros to get four digits: 0011

Find your place holders:18041211{\displaystyle 1^{8}0^{4}1^{2}1^{1}}

Add up the digits:8+0+2+1=11{\displaystyle 8+0+2+1=11}

Final Answer: B

Method2

Converting Long Binary Strings

1

Cut your string of binary numbers into groups of four, starting from the right. Hexadecimal converts 4 binary digits into one hexadecimal unit. So, in order to convert the number, you first need to break it up into groups of four, starting on the right. For example:

Add extra zeros to the front of the first number if it is not four digits. The zeros will not affect the conversion, but they will make it easier to visualize. Remember, you want all groups of 4-digit binary numbers.

Convert one 4-digit group at a time. You'll need to convert each binary set by itself, so separate them on your paper to make them easier to work with. Work on converting each individual string of four into its hexadecimal counterpart. For our example:[4]

0011=0+0+2+1=3{\displaystyle 0011=0+0+2+1=3}

1011=8+0+2+1=11=B{\displaystyle 1011=8+0+2+1=11=B}

0010=0+0+2+0=2{\displaystyle 0010=0+0+2+0=2}

1001=8+0+0+1=9{\displaystyle 1001=8+0+0+1=9}

4

Remove the spaces to create you hexadecimal number. Once you've converted all the 4-digit parts, simply ram them together to get your final answer. So, for the example above:

(0011) (1011) (0010) (1001)</math>

3 B 2 9

11101100101001=3B29{\displaystyle 11101100101001=3B29}

5

Memorize or check a conversion table to see if you got each part right. There are only 16 possible 4-digit combinations of binary numbers. So, if you don't want to figure out each string individually, you can use this conversion table.

Community Q&A

First add two leading zeros so that you have enough digits to split into equal 4 bit sections: (00)100101
Now split into two equal 4 bit sections (0010)(0101)
Convert each four bit section into their respective hex values:
0010 = 2
0101 = 5
(0010)(0101) = (2)(5) = 25
This should not be confused with the decimal (base 10) value 25.

To convert Binary to hexadecimal you need to know that the four numbers each have values.
8 4 2 1
0 1 0 1
These numbers only equal the values if there is a 1 under them for example this number would be 5 because there is only a 1 under 4 and 1. You would then change your answer in this example 5 into hexadecimal which is 5. For 8 number binary like 00101011 you want to split them up into 2 different parts. 0010 and 1011. To do this you do the exact same as you did for the previous one but you put the 2 answer together for example 2 and 13 would be 2D.

If this question (or a similar one) is answered twice in this section, please click here to let us know.

Video

Tips

Binary is base two (there are only two numbers, 1 and 0). Hexadecimal is a base sixteen system. Can you figure out why you need four binary numbers to convert to hexadecimal? It is because you need four separate two's, since 24=16{\displaystyle 2^{4}=16}.

Warnings

If you are finding a hex equivalent to a binary-encoded address and if you do this wrong, the results in hex-encoded address inputs will be messed up.

Thanks to all authors for creating a page that has been read 446,175 times.

Did this article help you?

Cookies make wikiHow better. By continuing to use our site, you agree to our cookie policy.

About this wikiHow

541 reviews

Click a star to vote

Click a star to vote

Thanks for voting!

Co-authors: 36

Updated:

Views: 446,175

"The 8421 notation and the long string of binary paired off in 4 was good. The best explanation I've seen. I now know to covert binary to hex without a converter and can do it in my head. Without the 8421 notation I would never have understood it."..." more-

"wikiHow's number system conversion tutorials are step by step and very easy to understand. Highly recommended for people new to these systems or people willing to get the basics right."..." more- Anonymous

"Basic conversion helps me a lot from the above article. Now I am able to convert any number into hex . Thank you so much, God bless you guys. You teach me in a very simple way."..." more- Anonymous

"What helped me the most was that the part where we "add" the four numbers in a binary string was explained very clearly using pictures with big numbers. Really cool effort!"..." more- Anonymous

Best way I've discovered for conversion. I've had difficulty without a calculator for the past 4 years.
- Kristofina Ndapandula Popawa

What was helpful is that you need to first group them into 4 and then convert it to a letter or number.
- Anonymous

A nicely-showed way of binary-to-hexadecimal conversion. I needed it for my Computer Science class.
- Sanurag Basu

Very helpful article, as I am studying for my GCSE computer science exam, this helped a lot!
- Adam Brown

This was simply explained so that a newbie can also understand it.
- Abdul Ali

It helped alot, now I'm fit to convert to hexadecimal.
- Douglas Okamun

It was very helpful, thanks to this big community.
- Mohammad Anbia Islami