Question:
Binary to Hexadecimal to the letters?
2011-09-13 21:13:30 UTC
I'm in college and I don't understand this and I'm afraid I'm going to drop out because of it. This is what my question says: Convert the follwoing binary numbers to hexadecimal: example 1110
I don't have the first clue how to do these, I know how to convert binary to decimal and stuff but I don't get the letters. I mean A is 10 but then when I look at a four digit number like 1110 converted which has a 10 in it, 11(10) it doesn't have the letter A in it at all! I looked up the answer and its 0x456! Why?! Or FF is 255, but F is supposed to be 15! There's no 15 in 255! I'm so confused and angry and going to drop out. Please explain this step by step, as if you were talking to a kindergarten student, like for dummies but even more dumb!
Five answers:
Stephen
2011-09-13 21:37:05 UTC
Remember that your 1110 is *binary* not *decimal*, so the fact that it has a "ten" and an "eleven" in it are irrelevant.



Also try not to think of A, B, C... as 10, 11, 12 in terms of *digits*, because you can get confused. Think of them only in terms of *quantities*. This is easier for bases less than 10 because there is no digit/quantity confusion. Bear with me on this - you are probably already doing this but it can be re-inforced.



So A represents ten (quantity) in whatever digit place it is in, and B represents eleven (quantity) not 11 (digits).



If you think this way, than you will see that hexadecimal has sixteen digit values, 0, 1, ... , E, F representing *quantity* zero, one, ..., fifteen, sixteen in whatever number position they are in.



This is similar to decimal where we learned to think of 734 as "seven in the hundreds place, three in the tens place, four in the ones place." So the hex number A42E is "ten in the 1000 (65536 decimal) place, four in the 100 (4096 decimal) place, 2 in the 10 (sixteen decimal) place and E in the 1 (one decimal) place."



Do the same for the binary. "10" is not ten, but is "one in the twos place, zero in the ones place," or two! Again, you are doing this at some level, but your question showed some confusion on this.



Binary-Hexadecimal conversion is very important in computer science, and is made much easier by observing that four binary digits can take on *exactly* 16 values:



0000

0001

0010

0011

0100

0101

0110

0111

1000

1001

1010

1011

1100

1101

1110

1111



So four binary digits can *together* represent one hexadecimal digit (since there are 16 different values for that one digit. If we count in binary and hex (with a decimal representation in parentheses) it looks like this:



0000 = 0

0001 = 1

0010 = 2

0011 = 3

0100 = 4

0101 = 5

0110 = 6

0111 = 7

1000 = 8

1001 = 9

1010 = A (10 in *decimal*, not binary)

1011 = B (11)

1100 = C (12)

1101 = D (13)

1110 = E( 14)

1111 = F (15)



Now if you break a binary number into groups of four, you can just convert each group independently, using the table above, and *not* be fooled by "ten" and "eleven" (which is *not* what the binary means!). Start grouping *from the right* and treat any "missing" digits in the highest order group as zero. So for instance:



1011010111010 binary = 1 0110 1011 1010 = 0001 0110 1011 1010 = 1 6 B A = 16BA hex
The Gnostic
2011-09-14 04:26:06 UTC
In hexadecimal, the digits are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.

The hexadecimal digit A has the equivalent value of the decimal number 10.

In the binary number 1110, those last two digits are not a decimal "ten", but a binary "one-zero."

In converting binary to hexadecimal, you have to start from the right and take the digits four at a time:

1110 = (14 in decimal) = E

You say you looked up the answer and found 0x456. This is the equivalent of the decimal 1110, not the binary 1110.

Hexadecimal FF (or 0xff) is the equivalent of decimal 255. This is because it equals 15 (F in hexadecimal) times 16, plus another 15. (15 × 16) + 15 = 240 + 15 = 255.



If you have a calculator handy, it's ridiculously easy to convert hexadecimal to decimal:

Start with the decimal of the fist hex. digit, multiply by 16, then add the next digit.

Repeat those last two steps until you've added the last digit.

Here's an example with A1B2C3:

10 × 16 + 1 = 161

(161) × 16 + 11 = 2587

(2587) × 16 + 2 = 41394

(41394) × 16 + 12 = 662316

(662316) × 16 + 3 = 10597059



To convert from decimal to hexadecimal takes a little more work. You have to keep track of remainders while dividing.

Here's how to convert a million to hexadecimal:

Start by dividing 1000000 by 16:

1000000 ÷ 16 = 62500 with remainder 0

62500 ÷ 16 = 3906 with remainder 4

3906 ÷ 16 = 244 with remainder 2

244 ÷ 16 = 15 with remainder 4 ... you can stop since the last quotient (15) is less than 16.

Take that quotient and tack on the remainders in reverse order: F4240
anonymousPerson
2011-09-14 04:34:59 UTC
In base ten, the different places are, from right to left, 10^0 (ones place), 10^1 (tens place), 10^2 (hundreds place), etc. There are ten digits, 0-9, and each digit can occupy any place, indicating a different value (e.g. a 9 in the tens place is a different value from a 9 in the ones place).



In base two, the places are, from right to left, 2^0 (ones place), 2^1 (2s place), 2^2 (4s place), etc., and there are only two digits that can be used in any place, 0 or 1, thought they are also used to indicate different values (e.g. a 1 in the 4s place represents a bigger value than a 1 in the 2s place). Let's say you have the number 1110 in base two; that's a 0 in the ones place, a 1 in the twos place, a 1 in the fours place, and a 1 in the eights place. 0+2+4+8=14, so that number would be 14 in base ten. In base sixteen, that number would be written as a single digit, E.



In base 16, the places are, from right to left, 16^0 (ones place), 16^1 (16s place), 16^2 (256s place), etc. The numbers from 0-9 are the same, and the numbers equivalent to those from ten to fifteen are written as A, B, C, D, E, and F. Let's say you have the hexadecimal number 3C. What is that in decimal? You have a 3 in the sixteens place and 12 in the ones place; 3*16 + 12*1 = 48+12 = 60.



To convert from binary to hexadecimal, group the digits in the given number by fours. Treat each group as though the digit on the right is a ones digit, the next digit over is a 2s digit, the next is a 4s digit, and the one farthest on the left is an 8s digit. If you have the binary number 1110, for instance, that's one group of four digits. In the ones place, you have zero, so you aren't adding one. You have a 1 in the twos place, so that's 2. You have a 1 in the fours place, so that's 4. You have a 1 in the eights place, so that's 8. Add up everything you have; 0+2+4+8=14, in base 10. Remember, though, you're converting to base 16, which has up to F in single-digit numbers (F=15, in base 10). 14 is one less than that, so it's E. A pair of digits is kind of irrelevant when converting between binary and hexadecimal, unless it's the last two digits on the left, left over after grouping the number into sets of four digits.



Given the hexadecimal number FF, that's an F in the sixteens place, and an F in the ones place. Remember that F is equivalent to fifteen, in decimal. So that's 15*16 (for the sixteens place) + 15*1 (for the ones place), which equals 255 in base 10.
Old Teacher
2011-09-14 04:53:50 UTC
You should never give up college because of one course!



Back to your question. All number bases use place value equal to powers of the base.



In base 10, 345 means 3*10^2+4*10+5



In base 16, you run out of digits, so A=10, B=11, etc and 10(base 16)= 1*16+0=16



1110 (base 10)= 4*16^2+5*16+6 = 456 (base 16)



To convert, divide by 16's



1110/16=69R 6

69/16= 4 R5

4/16=0R4



Then the remainders tell you the answer 456 (base16)

-------

F is 15

FF= 16*15+ 1*15= 255 (base10)



-----



Say you had the number A3B4 in hex.

10*16^3+3*16^2+11*16+4=40960+768+176+4= 41908 ( base10)



-----



In binary you only have 1 and 0



So 1011 means 1*2^3+ 0*2^2+1*2+1= 11 (base10) = B (base16)



Hoping this helps!
Alex
2011-09-14 04:40:15 UTC
In biniary, A is not 10. Its is 10 in decimal, but in binary, it is 1010.



F is 15 in decimal, but in binary, it is 1111. Hence FF is 15x15 in decimal but it is 1111x1111 in binary.



Make a list of the biniary powers to solve this?

e.g. 2^3 +2^2 + 2^1+ 2^0



For example you have 1010. For each of the digits in binary, 1x8 + 0x4 + 1x2 + 0x1, which is 10 then convert to hex.

Divide your decimal by 15 and the remainder is your ones digit in hex. Remember, small steps!


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...