# Thread: binary to ASCII conversion

1. ## binary to ASCII conversion

can i write a code to convert a binary number into an ASCII one, has anyone done it? thank you

2. I'm not sure what you're asking. It makes no more sense than converting a chicken into a telephone. ASCII is not a numbering system, it's a set of values that correspond to a set of characters. For example, 65 is the value of 'A' using ASCII. An example of a binary number would be 1000001. This number when converted to decimal is 65.

Please explain more clearly what you want to achieve. Are you stuck with converting 1000001 to 65, or are you stuck converting 65 to 'A' (for example)?

3. Only you know if you can. Yes, someone has. You're welcome.

Quzah.

4. Sure, it's easy if you know how binary works.

0000 0000
This is a single byte in binary (8 bits) Each bit in the byte has a weighted value. Starting from the right bit with 1, and then doubling with each bit to the left.
Code:
```0   0   0   0     0   0   0   0
128 64  32  16    8   4   2   1```
If you add that up, that totals 256 possible numbers (0 - 255). Just take your byte in binary, apply the weighted values to the bits that are 1, and then cast your result as a character.

An example:
Code:
```0   1   0   1     0   1   1   1
64      16        4   2   1```
64 + 16 + 4 + 2 + 1 = 87 = 'W'

You see?