How-to Guide 5 min read

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.

text to asciiascii code of aascii table decimal hexconvert text to ascii codeascii value of characters

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

CharacterDecimalHexBinary
Space322000100000
!332100100001
#352300100011
.462E00101110
0483000110000
9573900111001
?633F00111111
@644001000000
A654101000001
Z905A01011010
a976101100001
z1227A01111010

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!"

CharacterDecimalHex
H7248
i10569
!3321

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

  • Open the Binary Code Translator and keep Text → Binary selected.
  • Type or paste your text.
  • Three boxes update as you type: Binary output (8-bit groups), Hexadecimal and Decimal (ASCII).
  • Click Copy on the box you need. Codes are separated by spaces, one per character.
  • 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:

    CharacterDecimal shownHex shownUTF-8 bytes (hex)
    é233E9C3 A9
    €836420ACE2 82 AC
    ₹837720B9E2 82 B9
    अ2309905E0 A4 85
    😀55357 56832D83D DE00F0 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.

    Try this tool on Lazyblink

    Put this guide into practice with our free online tool — no signup required.

    Open tool