Text to ASCII Code: Convert Letters to Decimal and Hex (With Table)
Convert text to ASCII codes in decimal and hex: a table of letters, digits and symbols, worked examples, the case rule, and what happens with é, ₹ and emoji.
The short answer
Every English letter, digit and common symbol has an ASCII code from 0 to 127. Capital A is 65 (hex 41), lowercase a is 97 (hex 61) and the digit 0 is 48 (hex 30). To convert a whole word, look up each character in turn: "Hi!" is 72 105 33 in decimal or 48 69 21 in hex. Type any text into the free Binary Code Translator and it shows the decimal and hex codes alongside the binary.
What ASCII is
ASCII is a list that gives each character a number. It covers 128 codes:
- 0 to 31: control codes such as tab (9) and line feed (10). They don't print.
- 32 to 126: printable characters, starting with the space (32).
- 127: delete, another control code.
Modern text uses Unicode, but Unicode kept the same numbers for these 128 characters. So the ASCII code of "A" is also its Unicode code point and its UTF-8 byte.
ASCII codes for common characters
| Character | Decimal | Hex | Binary |
|---|---|---|---|
| Space | 32 | 20 | 00100000 |
| ! | 33 | 21 | 00100001 |
| # | 35 | 23 | 00100011 |
| . | 46 | 2E | 00101110 |
| 0 | 48 | 30 | 00110000 |
| 9 | 57 | 39 | 00111001 |
| ? | 63 | 3F | 00111111 |
| @ | 64 | 40 | 01000000 |
| A | 65 | 41 | 01000001 |
| Z | 90 | 5A | 01011010 |
| a | 97 | 61 | 01100001 |
| z | 122 | 7A | 01111010 |
The pattern makes the rest easy to work out:
- Capital letters run from A = 65 to Z = 90 in alphabetical order. M is the 13th letter, so it is 64 + 13 = 77.
- Lowercase letters run from a = 97 to z = 122.
- Digits run from 0 = 48 to 9 = 57. The code for a digit is 48 plus the digit.
The 32 rule
Lowercase is always exactly 32 more than the same capital letter: A is 65 and a is 97; Z is 90 and z is 122. In hex the gap is 20, so 41 becomes 61.
In binary, 32 is a single bit (00100000). That is why changing case is so cheap for a computer: it flips one bit.
Worked examples
"Hi!"
| Character | Decimal | Hex |
|---|---|---|
| H | 72 | 48 |
| i | 105 | 69 |
| ! | 33 | 21 |
Decimal: 72 105 33. Hex: 48 69 21.
"Cat 5"
Decimal: 67 97 116 32 53. Hex: 43 61 74 20 35.
Note the space (32 or 20) and that the digit 5 is code 53, not 5. A common mistake is to write digits as their own value.
How to convert with the tool
The reverse direction, Binary → Text, takes 8-bit groups separated by spaces. If you have decimal or hex codes and want text, convert each code to binary first, or look it up in the table above. The binary side is covered in how to convert text to binary and the binary alphabet chart.
What about é, ₹, Hindi letters and emoji?
These aren't ASCII, so there is no ASCII code for them. What you get depends on the tool.
This tool shows each character's UTF-16 code unit, which is how JavaScript stores text. For most characters that is the same as the Unicode code point:
| Character | Decimal shown | Hex shown | UTF-8 bytes (hex) |
|---|---|---|---|
| é | 233 | E9 | C3 A9 |
| € | 8364 | 20AC | E2 82 AC |
| ₹ | 8377 | 20B9 | E2 82 B9 |
| अ | 2309 | 905 | E0 A4 85 |
| 😀 | 55357 56832 | D83D DE00 | F0 9F 98 80 |
Two things to notice:
- The numbers are above 127. For é (233) the binary still fits in 8 bits, but it isn't ASCII. For € and ₹ the binary output is 14 bits long, and for अ it is 12. Other tools may show the UTF-8 bytes instead (the last column), which is what a file on disk actually contains.
- Emoji come out as two numbers. 😀 is code point 128512 (hex 1F600), but JavaScript stores it as a pair of code units, 55357 and 56832. The tool shows the pair.
If you are working with files, network data or a programming language that uses UTF-8 (most do), use the UTF-8 bytes. If you need the Unicode code point, use the U+ value, such as U+20B9 for ₹.
Getting ASCII codes in code
- JavaScript:
'A'.charCodeAt(0)returns 65.String.fromCharCode(65)returns "A". - Python:
ord('A')returns 65.chr(65)returns "A".hex(ord('A'))returns '0x41'. - Excel or Google Sheets:
=CODE("A")returns 65 and=CHAR(65)returns A. For non-ASCII characters,=UNICODE()is more reliable.
Common mistakes
- Treating digits as their own value. "7" is code 55, not 7.
- Forgetting spaces. A space is a character with code 32 and must be counted.
- Mixing decimal and hex. 41 in hex is 65 in decimal. Label which one you're using.
- Calling é or ₹ "extended ASCII". Several incompatible 8-bit tables were called extended ASCII. Unicode is the safe reference today.
Frequently asked questions
What is the ASCII code of A?
Capital A is 65 in decimal and 41 in hex. Lowercase a is 97 in decimal and 61 in hex.
How do I convert text to ASCII codes?
Look up each character's code, including spaces and punctuation. For example, Hi! is 72 105 33 in decimal. The Binary Code Translator shows the decimal and hex codes for any text you type.
What is the difference between uppercase and lowercase ASCII codes?
Lowercase letters are always 32 higher than the same uppercase letter, so A is 65 and a is 97. In binary that is a single bit.
Does ₹ or an emoji have an ASCII code?
No. ASCII only covers codes 0 to 127. ₹ is Unicode U+20B9 (8377 in decimal), and emoji have code points above 65,535, which JavaScript stores as two numbers.
Put this guide into practice with our free online tool — no signup required.
Open tool