If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

### Course: Algebra (all content)>Unit 1

Lesson 14: Binary and hexadecimal number systems

# Converting directly from binary to hexadecimal

To convert from binary to hexadecimal, we can split the binary number into groups of four digits. Each group of four binary digits can be converted into one hexadecimal digit. We can use a table or chart to figure out which hexadecimal digit matches each group of four binary digits. Once we have converted each group, we put the hexadecimal digits together to get the final answer.

## Want to join the conversation?

• At , why does he take 4 places? Why not less? Why not more?
• as 16 is 2 to the power of 4, thus he takes 4 places
• Can the reverse be done?
``(hex) to (bin)``

And what happens when the number is a decimal (E.g. 101.01)?
• 1) Yes, the reverse can be done (hint: read up the "blackboard" instead of down).
2) is the number has a (WARNING: math jargon approaching...) a radix point, you can work it directly - just ignore the dot when you make your answer, then put it back in the place you took it from - or convert it to decimal, and then go from decimal to your desired base.
• I think the best way to pronounce numbers with a base bigger than 10 is to simply say the individual numbers. For 16E, just say, "one-six-E." That's what Science Bowl proctors did, anyway.
• Is it still "converting directly" If you have to count in decimal system to work out how many e.g. 1s there are?
• He is counting in decimal to help the viewers understand why it works. Normally, you would see a binary pattern, say 1101, and add them in base-16. 8+4 = C, and C+1 = D, so 1101 (binary) = D (hexadecimal). Or if you have a hexadecimal number, say FC9, you would do the process in reverse. F = 8+4+2+1 and that is equal to 1111 in binary. C = 8+4. So FC9 (hex) = 1111 1100 1001.

Don't confuse those "8+4+2+1" as decimal, they are in fact hexadecimal. 8+4 = C, then C+2=E, and then E+1=F. Notice that not once throughout the explanation I used decimal numbers, so I can convert any hexadecimal number to binary number and vice versa without even knowing what those numbers are in decimal.
• I don't really get how the sixteens and the 256s place are between 0-F
• - sixteens can take values from 0x16 up to Fx16
- so are 256s(16²) which can take values from 0x16² up to Fx16²
- so is any position of power of sixteen which will always take values multiplied by 0 up to F
• Are there ways to convert directly from any base x to any base y where y is not 10 or a power of x like for example base 2 -> base 3?
• Sure, digit m of number x in base b is just: x mod b^m where mod is the remainder function that gives the rest of the division (so 27 mod 17 its 10, for example).
(1 vote)
• How do you convert a number from BASE-16 to BASE-2 or BASE-4
• You reverse the process. Each base-16 digit becomes four binary digits:

e.g. 159E_16 = 0001 0101 1001 1110_2

The process for base four is similar, only each base four digit is 2 bits:

0123_4 = 00011011_2 = 1B_16. I find it easier to convert to binary and back to hex, as you see here. This shows one way of noting one byte, or eight bits.

I use _16 to denote base 16 and _2 to denote base 2 here.
(1 vote)
• How do you convert 1.63 into BASE-16?