• Congratulations to the Class of 2024 on your results!
    Let us know how you went here
    Got a question about your uni preferences? Ask us here

Converting (1 Viewer)

Joined
May 27, 2004
Messages
107
Gender
Male
HSC
2004
Hey whats the easiest way to convert from binary to hex, binary to decimal, hex to decimal and the viceversas

without showing like all the working
 

acmilan

I'll stab ya
Joined
May 24, 2004
Messages
3,989
Location
Jumanji
Gender
Male
HSC
N/A
I was taught to always convert to binary first so thats what i use.

ie. to convert from hex to decimal, first convert hex to binary and then binary to decimal. As for from binary to hex, isnt there only one way? If there is another way, the way i do it is by splitting the binary number into groups of four and putting it into tables

ie. 10100111

Split into groups of four 1010 and 0111

Put into table
8 4 2 1
1 0 1 0 = A
0 1 1 1 = 7

So 10100111 = A7
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
dastonecutters said:
Hey whats the easiest way to convert from binary to hex, binary to decimal, hex to decimal and the viceversas

without showing like all the working
If you don't want to do the conversions, this is a quick way:

Binary to Hexadecimal
Group the binary digits in groups of 4. Convert each group of 4 into its hex equivalent. Example:

take 10111111 and conver to hex
1) Take groups of 4: 1011 1111
2) Convert each group to hex equivalent:
1011 = 11 => B
1111 = 15 => F
thus, 10111111 => BF

If the binary number is not evenly divisible by 4, add extra zeros to pad the number, grouping them from right to left. Example:
11010 => what in hex?
1) Group in four:
1 1010 => 0001 1010 => 1A


Binary to Decimal
Quickest way I know for this is to add the different powers of two where there is a 1 in the binary representation.


Hex to Decimal
Do Hex => Binary => Decimal.

Hex => Binary is the reverse of the first conversion. For each digit in the hex representation, convert it to a 4 digital binary number.

If you can't figure a conversion out, you can always convert it to binary first and go from there.

Easiest way of course is if you're allowed, use a calculator.
 

SamD

Member
Joined
Jul 21, 2002
Messages
256
Gender
Male
HSC
N/A
To convert hex to dec why not just do it directly...

eg.
A4 = (10*16) + (4*1) = 164

HTH
Sam
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top