# Learn basic ascii with hex, and convert it to dec and bin.

9 posts / 0 new
#1 24 January, 2015 - 14:03
Offline
Joined: 3 years 4 months ago

#### Learn basic ascii with hex, and convert it to dec and bin.

Would you like to learn basic ascii? Yes, keep reading.

The common ascii table has 95 characters, just the numbers and letters are 62 characters, the other symbols are the remaining 33.

We are going to learn this with their respective hecadecimal code, it is easier to learn and convert to decimal and binary.

The easiest way to convert hex to dec is by knowing the multiples of 16 wich are: 16,32,48,64,80,96,112. Thats all we need.

Convert 25 to dec: you multiply the first digit with 16 and add the second digit, 2x16: 32, and then 32+5: 37, that's our answer.

Convert 25 to bin: if you can count in binary then you convert each digit: 0010 and 0101, but you put them together: 00100101.

Now, to convert from dec to hex, you have to find the multiple of 16 below the given number, and then the difference.

Convert from dec to hex: 84, ok 16x5: 80, our first digit is 5, then 84-80: 4, our last digit is 4, our answer is 54.

Convert 50 to hex: 16x3 is 48, first digit of our answer is 3, 50-48: 2, our answer is 32

So, let's begin with the numbers: they are all the same, you just put a 3 before the wished number, here is a table.

30:0
31:1
32:2
33:3
.
.
.
39:9

also, we have to know that a "space" between words or numbers is 20 ( always in hex )

Decipher this to continue with the letters, don't use a convert. ;)

51 32 49 52 49 53 57 50 54 53 52.

P.D: this numbers are in dec, convert them to hex and find their value. Remember that a 20 in hex, or 32 in dec means a space. ( just a space, no character at all )

2 February, 2015 - 12:09
Offline
Joined: 2 years 7 months ago

chiguin wrote:
Convert 25 to bin: if you can count in binary then you convert each digit: 0010 and 0101, but you put them together: 00100101.

Why does the 5 become 0101 rather than 101? Should one always use four digits? (due to 8's and 9's having four digits?)

2 February, 2015 - 14:55
Offline
Joined: 5 years 9 months ago

I was confused by for a bit too, that's the conversion of 25 (base 16) into binary.
00100101 (binary) = 37 (decimal)

Decimal to binary conversion is easy enough though, 12 (dec) you move from left to right and add in the next largest multiple of 2... that was very badly explained!

Let's see... binary is 1, 2, 4, 8, 16, 32, 64, 128,

Going left to right if we have decimal 12, then the next binary largest multiplier is 8, so we keep the eight, then adding the four we get twelve already:
128 (0), 64, (0), 32 (0) 16 (0), 8 (1), 4 (1), 2 (0), 1 (0).

or
0000 1100

For the decimal number 26:
128 (0), 64, (0), 32 (0) 16 (1), 8 (1), 4 (0), 2 (1), 1 (0).
0001 1010

For the decimal number 19:
128 (0), 64, (0), 32 (0) 16 (1), 8 (0), 4 (0), 2 (1), 1 (1).
0001 0011

2 February, 2015 - 22:13
Offline
Joined: 3 years 4 months ago

Hi Josh, you're right.

Why is 5, 0101 instead of simply 101? well, we are working in hexadecimal, in other words, there are 16 items, here is the list:

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

By the way 101 is 5 in Octal ( base 8 ) 0101 is 5 in hex ( base 16 )

So we need the extra binary to differentiate between 5 and D/13 ( 0101 and 1101 respectively.

Sooo, the answer is yes. ;)

2 February, 2015 - 22:26
Offline
Joined: 2 years 7 months ago

Thanks, now I see. :)

I skimmed it and went straight for the binary part, since I didn't know how to convert from larger decimal numbers, and I wanted to learn that...

Decimal: 51 32 49 52 49 53 57 50 54 53 52

Nice message. :grade:

2 February, 2015 - 23:23
Offline
Joined: 3 years 4 months ago

Were you able to convert the decimal message? if you did, post your result, if you didn't, the instructions are in the first comment.

And... if you post your result ( doesn't matter if it isn't 100% right ) we'll continue learning the letters In ascii. !!!

3 February, 2015 - 00:13
Offline
Joined: 2 years 7 months ago

Yes. I edited my comment to remove the answer, in case anyone else wants to try. :)

I'll post it another way that won't spoil it:
answer

3 February, 2015 - 00:23
Offline
Joined: 3 years 4 months ago

You got 100% right with the numbers Josh, good job. ;)

3 February, 2015 - 00:28
Offline
Joined: 3 years 4 months ago

Thank you Liamvictor, for showing us how to convert from decimal to binary.

Now we'll learn the letters: ( IMPORTANT: all the numbers shown here are in hexadecimal. )

The first set ( they begin with 4 or 6 ) goes from a-o ( from the letter "a" to the letter "o" )

The second set ( they begin with 5 or 7 ) goes from p-z ( from "p" to "z" )

If their hex code begins with 4 or 5, its an uppercase letter.

If their hex code begins with 6 or 7, its a lowercase letter.

Lets begin with the first set:

Ok, if the letter begins with 4 or 6 then the next number ( the second digit ) will simply be the position of the letter in the alphabet..

For example, the letter a ( or vowel ):

A: 41 ( begins with 4 so it is an uppercase, and ends with 1 because "a" is the first letter of the alphabet )

a: 61 ( begins with 6 so it is a lowercase, and ends with 1 because "a" is the first letter letter of the alphabet )

Here is a table:

A/a: 41/61
B/b: 42/62
C/c: 43/63
D/d: 44/64
E/e: 45/65
F/f: 46/66
G/g: 47/67
H/h: 48/68
I/i: 49/69
J/j: 4A/6A
K/k: 4B/6B
L/l: 4C/6C
M/m: 4D/6D
N/n: 4E/6E
O/o: 4F/6F

Here is a small numerical translation:

A: 10 thats why J ends with A
B: 11 " " K ends with B
C: 12 " " L ends with C
D: 13 " " M ends with D
E: 14 " " N ends with E
F: 15 " " O ends with F

And now, how do I know with which letter does each letter ends with, here is where mnemonics helps us.

The formula is:
letter from the alphabet+hex letter

So the word for "J" could be jazz ( imagine a saxo ) because if we look at the table, we'll see that "J" ends with "A"

A small story: mmm the letter "J" is in the first group so, it begins with 4 or 6, I'll write the lowercase, so I'm going to use the number 6, my mnemonic word for "J" is jazz, now i'll type the letter "A" and my final result is 6A, end of the story.

P.D: my word for "O" is office, because if you look at the table, you'll see that "O" ends with "F".

At the same time, these mnemonic images will help you to find the position of the letter in the alphabet.

For example, where is the letter "o":

Since I know that the letter "F" in hexadecimal means 15 and my image for the letter "o" is office, then the letter "o" has the 15th position in the alphabet ( you can count letter by letter if you want ;) )

I'll post the second part soon ( or later )

Have questions, feel free to ask.

Decipher this to proceed.

This is in hex: 48 65 6C 6C 6F

Learn memory techniques for free! Just click the "Sign up" button below to create an account and we'll send you an email with some tips on how to get started.