Hexadecimal
Convert Hex to Binary, Decimal and back again
HEXADECIMAL
As seen in decimal and binary we use a Base 10 and Base 2 respectively. This means that in decimal (deci- means 10) we use 10 numbers, zero to 9 (0,1,2,3,4,5,6,7,8,9) = 10 numbers and then combinations of those numbers In binary, we use a Base 2 (or 2 numbers) these being 0 and 1
In hexadecimal, this is a Base 16 (or 16 numbers/symbols) This comprises of numbers 0-9 and A-F (ie 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) In this case A=10, B=11, C=12, D=13, E=14 and F=15)
In Binary 15 is equivalent to 1111 (8+4+2+1) and 0 is equivalent to 0000
Lets say we wanted to convert 128 to Hexadecimal, we would need to covert it to Binary first, and then split it into 2 portions of 4 bits
Decimal | Binary | Hexadecimal |
128 | 10000000 | 1000 | 0000 = 80 |
We split this up into 2 sets of 4 bits because Hexadecimal, the number 15 is F (1111), so in the case of 128, the Hexidecimal number is 8 and a 0 which equals 80.
So what about 255. Lets convert this to binary
Decimal | Binary | Hexidecimal |
255 | 11111111 | 1111 | 1111 = FF |
198 | 11000110 | 1100 | 0110 = C6 |
224 | 11100000 | 1110 | 0000 = E0 |
Lets try an IP Address, we will just work out the 10 and 1
IP | Binary | Hexidecimal |
10.1.1.1 | 00001010.00000001 | 0000 | 1010 . 0000 | 0001 = 0A.01.01.01 |
My Table I Use:
Bits | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Mask | 128 | 192 | 224 | 240 | 248 | 252 | 254 | 255 |
Last updated