Question:
what is the method to convert a number from hexadecimal to binary,binary to hexadecimal?
rajashekhar_hubli
2006-09-07 02:31:46 UTC
i want to know different number systems like binary,octal,hexadesimal,decimal etc.and converting value from one number system to another number (means equalant numbers in different number systems -,their representation and convertion)
thank you....
Five answers:
M1976
2006-09-07 03:24:41 UTC
First you must understand our decimal system. Decimal is the numbers based on 10. like a number, 45 = 4x10 + 5, 567 = 5x100+6x10+7



So, a number of base 10 can be represented as, ax10^(n-1)+bx10^n-2)+...+cx10^0, a,b,..,c can be 0-9



Similarly a number binary can be represented by,

ax2^(n-1)+bx10^n-2)+...+cx2^0, a, b, c can be either 0 or 1

An octal number,

ax8^(n-1)+bx8^n-2)+...+cx8^0, a,b,c can be 0-7



etc



Now, let say the decimal number is 789

How you get it,

1. u divide the number by 10, get 78. remainder 9

2. u divide 78 by 10, get 7, remainder 8

3. u divide 7 by 10, get 0, remainder 7



So, the number is 789, see bottom to top



Similarly, if u need binary representation of the number u have divide the number by 2 untill u cannot divide the number anymore,

example, 23

1. First divition by 2, get 11, remainder 1

2. 2nd divition of 11, get 5, remainder 1

3. 3rd div of 5, get 2, remainder 1

4. 4th div, get 1, remainder 0

5. 5th div, get 0, remainder 1



So, 23 in binary is 10111



Similarly u get the numbers from decimal to octal and hexadecimal.

Decimal number represenation u know: NUM(base 10)

Hexa: NUM(base 16) = 0-9,A,B,C,D,E,F

Octal: NUM(base 8) = 0-7

Binary: NUM(base 2) = 0,1



Now the conversion,

U already know by now decimal to binary, octal, hexadecimal conversion and vice versa (see above again)



Binary to Hex and vice versa:

Lets say the binary number is(23D): 10111 or (0001)(0111)

So, the hexa form of the number is, 17 (0001B = 1H, 0111B = 7H:::: also, 1x16^1 + 7 = 23)

Similarly if u get 17H, u know binary form is 0001 0111

The key is group of 4 from end



Binary to Octal and vice versa:

23D = 10111B = 010 111 B = 27O, as 010B = 2O, 111B = 7O



Similarly when u get 27O, u know the binary form 010111B

The key is group of 3 from end

Hex to Octal:

17H = 0001 0111B = 010 111 (always start from end, and make group of 3) = 27O

Octal to Hex:

27O = 010 111B = 0001 0111(always start from end, and make group of 4) = 17H



Hope this helps
albinopolarbear
2006-09-07 03:31:07 UTC
Well, once you get the hang of it, binary to hex is easy. Break the binary down to chunks of 4.





In binary, you count by ones; 0, 1, 10, 11, 100, 101, 110, 111, 1000, etc.

Decimal, the normal system is of course; 0, 1, 2, 3, etc.

Hexadecimal starts like decimal but continues; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10, 11, etc. where A = 10 F =15, and so on



I'll use the decimal number 10 for an example for conversions.

1 0 - The decimal number

10 1 - The place values



In binary, it would be written as 1010

1 0 1 0 - The binary number

8 4 2 1 - The place values

The 1 over the 8 and 2 add together to equal 10



In hex, it would be written simply as A



A - The Hexidecimal number

1 - The place value

In hex, A = 10, and 10 times 1 (the place value) is 10. Sorry about the math being so simple, but I didn't want the binary to take forever.



This can be applied to large binary numbers to convert them to hex.



11001101010111110100 in binary for instance.



First break it up into groups of four



1100 1101 0101 1111 0100

now you simply convert the groups into single hex digits.



Binary 1 1 0 0

Place Value 8 4 2 1



8+4=12



Hex counts 1, 2, 3, 4, 5, 6, 7, 8, 9, A (equal to 10), B (11), C (12), D (13), E (14), F (15), 10 (equal to 16), and so forth



So, 12 in decimal is equal to C in hex, the fist digit is C



Binary 1 1 0 1

Place Value 8 4 2 1



8+4+1=13



In hex, 13 is equal to D, so the second place is D





Binary 1 1 1 1

Place Value 8 4 2 1



8+4+2+1=15

15 in hex is wirtten F, so the third place is F





Binary 0 1 0 0

Place Value 8 4 2 1



4+0=4

4 in decimal is still 4 in hex, so the last digit is 4



So, putting them together, you get CDF4 as your hex equivilent of 1100110111110100 binary.



The same works in reverse for converting hex to binary.



The place values in hex go

4096 256 16 1



Here is a conversion table for binary to hex/hex to binar if you want it, but it might be hard to memorize.



Binary Decimal Hex



0000 0 0

0001 1 1

0010 2 2

0011 3 3

0100 4 4

0101 5 5

0110 6 6

0111 7 7

1000 8 8

1001 9 9

1010 10 A

1011 11 B

1100 12 C

1101 13 D

1110 14 E

1111 15 F

10000 16 10



Hope that helped at least some, sorry if I couldn't explain that very well though. Also, I had the table all spaced out and easy to read, but when I hit preview, it shrank it and now is hard to read. Also, you add h to the end of any hex number.
Truth Seeker
2006-09-07 02:42:37 UTC
Binary to Hex Conversion

It is easy to convert from an integer binary number to hex. This is accomplished by:



Break the binary number into 4-bit sections from the LSB to the MSB.

Convert the 4-bit binary number to its Hex equivalent.



For example, the binary value 1010111110110010 will be written:



1010 1111 1011 0010

A F B 2





--------------------------------------------------------------------------------



Hex to Binary Conversion

It is also easy to convert from an integer hex number to binary. This is accomplished by:



Convert the Hex number to its 4-bit binary equivalent.

Combine the 4-bit sections by removing the spaces.



For example, the hex value 0AFB2 will be written:



A F B 2

1010 1111 1011 0010



This yields the binary number 1010111110110010 or 1010 1111 1011 0010 in our more readable format.



TABLE:-



Binary Octal Decimal Hex

0000B 00Q 00 00H

0001B 01Q 01 01H

0010B 02Q 02 02H

0011B 03Q 03 03H

0100B 04Q 04 04H

0101B 05Q 05 05H

0110B 06Q 06 06H

0111B 07Q 07 07H

1000B 10Q 08 08H

1001B 11Q 09 09H

1010B 12Q 10 0AH

1011B 13Q 11 0BH

1100B 14Q 12 0CH

1101B 15Q 13 0DH

1110B 16Q 14 0EH

1111B 17Q 15 0FH

1 0000B 20Q 16 10H
2006-09-07 02:52:49 UTC
Email me if u not successful, i have a conversion of binary and hex at home some where. you can also try the wikipedia.
â?  MÎ?Я©ỮÅ?Â¥ â?¢ â? 
2006-09-07 02:38:25 UTC
I assume u have a scientific calculator... ;)


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