2

How do I convert this hexadecimal address to a decimal address?

0*FFFF0000
1
  • By the way, it really is an x, indicating that it's hexadecimal by starting with 0x.
    – Daniel Beck
    May 10, 2011 at 5:01

4 Answers 4

5

Use the Windows Calculator to convert from Hex to Decimal:

Choose "Programmer" option from the "View" menu:

enter image description here

Make sure that you enter the number while the calculator is in "Hex" mode. After entering the number switch to "Decimal" mode. And you have the answer...

enter image description here

1
  • thank u! but how to do it therotically becoz in exam we do not have calculator
    – samia
    May 9, 2011 at 18:33
5

Each placeholder is worth whatever the base is set to. In decimal it is 10. So the number 123 for instance:

  • Has a '1' in the 100 place that's worth 100
  • Has a '2' in the 10 place that's worth 20
  • Has a '3' in the 1 place that's worth 3

The same idea applies to base 16 (e.g., hexadecimal -- hex meaning 6 and decimal meaning 10 -- 16). Each placeholder goes up to 16. Since we're used to only 10 digits, we substitute letters for 11 through 15. In hexadecimal, one placeholder can have values 0 through 15.

Decimal:     0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Hexadecimal: 0 1 2 3 4 5 6 7 8 9 A  B  C  D  E  F  10 11 12 13 14

0* indicates that it's base 16 (although this is the first time I've seen it). Another popular notation ix 0x.

For your example, there are 8 places. FFFF0000 means:

(15 * 16^7) + (15 * 16^6) + (15 * 16^5) + (15 * 16^4) + (0 * 16^3) + (0 * 16^2) + (0 * 16^1) + (0 * 16^0) = 4,294,901,760 = 0*FFFF0000

Sounds complicated right? It's not, really. The same thing is done with decimal:

(4 * 10^9) + (2 * 10^8) + (9 * 10^7) + (4 * 10^6) + (9 * 10^5) + (0 * 10^4) + (1 * 10^3) + (7 * 10^2) + (6 * 10^1) + (0 * 10^0) = 4,294,901,760 = 0*FFFF0000

Wikipedia's page on Hexadecimal goes into more detail.

Your question is tagged with IP, so that uses dotted decimal notation -- a lot easier than that. Usually it's expressed in 255.255.255.255. The great thing about Hexadecimal is that it can represent this very easily as FF is 255. Your address in question translates to 255.255.0.0 and then in dotted hexadecimal notation (is there such a thing?) it's FF.FF.00.00.

3
  • thank U? :))) what about from hexa to binary
    – samia
    May 9, 2011 at 19:00
  • Binary is means base 2, so it's all 0 and 1 from there. If you're using IPv4 then it's usually in dotted decimal which makes converting to dotted 'binary' a lot easier because then you only have to translate a few numbers at a time and then combine them at the end. For example, if you had the FFFF0000 number, then it could be translated to FF.FF.00.00 and then take the FF's into binary with 11111111 and the 0's with all 0's to 11111111.11111111.00000000.00000000.
    – Nitrodist
    May 9, 2011 at 19:04
  • Hex to binary and the other way around is pretty simple. Just convert each character of the hex string into 4-bit binary value: 0: 0000 1: 0001 2: 0010 3: 0011 4: 0100 5: 0101 6: 0110 7: 0111 8: 1000 9: 1001 A: 1010 B: 1011 C: 1100 D: 1101 E: 1110 F: 1111 So 0xFFFF0000 is F F F F 0 0 0 0 1111 1111 1111 1111 0000 0000 0000 0000 Unfortunately formatting here seems not to be reflected... I am going to post another answer.
    – SkyBeam
    May 9, 2011 at 19:31
4

0*FFFF0000

How about doing it manually? ;)

0x16^0 + 0x16^1 + 0x16^2 + 0x16^3 + 15x16^4 + 15x16^5 + 15x16^6 + 15x16^7 =
0x1 + 0x16 + 0x256 + 0x4096 + 15x65536 + 15x1048576 + 15x16777216 + 15x268435456 =
0 + 0 + 0 + 0 + 983040 + 15728640 + 251658240 + 4026531840 =
4294901760

As you have asked how to convert hex to binary and the other way around here's the answer:

Hex to binary and the other way around is pretty simple. Just convert each character of the hex string into 4-bit binary value:

0: 0000
1: 0001
2: 0010
3: 0011
4: 0100
5: 0101
6: 0110
7: 0111
8: 1000
9: 1001
A: 1010
B: 1011
C: 1100
D: 1101
E: 1110
F: 1111

So 0xFFFF0000 is:

   F    F    F    F    0    0    0    0
1111 1111 1111 1111 0000 0000 0000 0000

another example of 0x0FA10021:

   0    F    A    1    0    0    2    1
0000 1111 1010 0001 0000 0000 0010 0001
0
0

4294901760 (minus the 0*)

Use TFM's method or use an online calc although real coders do it in there head. Ok that last parts a lie but at least we claim to.

Not the answer you're looking for? Browse other questions tagged .