How to Find the ASCII Code of a Character and Read the ASCII Table
Find the ASCII value of any character and learn how to read an ASCII encoding table, with worked examples for 0, underscore, x and z.
Every character a computer stores as text is really a number. ASCII (American Standard Code for Information Interchange) is the encoding table that assigns those numbers to basic English letters, digits, punctuation and a set of control signals. If you need to know which number stands behind a symbol, or decode a number back into a symbol, this guide shows how to look it up, how to read the table correctly and how to check your result.
What an ASCII lookup does for your text
An ASCII lookup is a read-only identification step. The input is a single character, or a string you inspect one character at a time. The output is that character's code, usually shown in decimal and often also in hexadecimal, octal or binary. Running the lookup in reverse turns a code back into its character. Nothing in your text is changed: you are only identifying what each character is, which is useful when debugging, comparing strings, sorting, escaping special characters or spotting a character that looks right but is not what you expect.
The scope matters. Standard ASCII is a 7-bit code with exactly 128 positions, numbered 0 to 127. Characters outside that range, such as accented letters, Cyrillic, emoji or curly quotes, have no ASCII code at all. For those you need a Unicode code point instead. The first 128 Unicode code points are identical to ASCII, so a Unicode inspector will give the same number for any plain ASCII character.
How the ASCII table is organized
- 0–31: control characters, such as tab (9), line feed (10) and carriage return (13). Most are invisible and do not print as a symbol.
- 32: the space character.
- 33–47: punctuation and symbols, including ! " # $ % & ' ( ) * + , - . /
- 48–57: the digits 0 through 9.
- 58–64: more symbols: : ; < = > ? @
- 65–90: uppercase letters A through Z.
- 91–96: symbols: [ \ ] ^ _ `
- 97–122: lowercase letters a through z.
- 123–126: symbols: { | } ~
- 127: DEL, a control character.
How to read an ASCII table step by step
- 1. Find your character in the column labeled Char, Symbol or Glyph. Check case carefully: uppercase and lowercase letters sit in different blocks with different codes.
- 2. Read across the same row to the number columns. Dec is decimal, Hex is hexadecimal (base 16), Oct is octal (base 8) and Bin is binary.
- 3. Use the column that matches where the number will be used. Programming escapes and byte dumps usually use hex; most beginner questions want decimal.
- 4. For control characters, the table shows an abbreviation (such as NUL, TAB, LF or DEL) instead of a visible symbol.
- 5. Some printed tables use a grid layout instead of a list. In that case the code is built from the row and column headings, typically the high hex digit from one axis and the low hex digit from the other. Combine them to get the hex value, then convert to decimal if needed.
Common lookups
| Character | Decimal | Hex | Binary |
| space | 32 | 20 | 0100000 |
| 0 (digit zero) | 48 | 30 | 0110000 |
| A | 65 | 41 | 1000001 |
| X | 88 | 58 | 1011000 |
| Z | 90 | 5A | 1011010 |
| _ (underscore) | 95 | 5F | 1011111 |
| a | 97 | 61 | 1100001 |
| x | 120 | 78 | 1111000 |
| z | 122 | 7A | 1111010 |
The value of 0 in ASCII
There are two different things people mean by "0 in ASCII." The digit character 0, the one you type on the keyboard, has decimal code 48 (hex 30). The code 0 itself belongs to NUL, an invisible control character that is not the digit at all. The digits run in order from 0 at 48 to 9 at 57, so subtracting 48 from a digit's code gives its numeric value.
Underscore, x and z
The underscore _ is 95 (hex 5F); it sits among the symbols between the uppercase and lowercase letter blocks. Lowercase x is 120 and uppercase X is 88. Lowercase z is 122, the highest letter code in ASCII, and uppercase Z is 90. Each lowercase letter is exactly 32 higher than its uppercase partner, which is why case conversion of ASCII letters is a simple arithmetic shift.
How to find the ASCII value of a character with code
If you have a programming environment or terminal available, you can get the code directly instead of scanning a table. The snippets below are illustrative examples based on each language's standard functions; the comments show the expected result for the characters used.
# Python
ord('_') # character to code -> 95
chr(122) # code to character -> 'z'
hex(ord('x')) # -> '0x78'
// JavaScript
'0'.charCodeAt(0); // -> 48
String.fromCharCode(88); // -> 'X'
# Bash: print the decimal code of a character
printf '%d\n' "'z" # -> 122
Note that Python's ord and JavaScript's charCodeAt return Unicode values, not strictly ASCII. For any character in the 0–127 range the two are the same. If the result is above 127, the character is not ASCII.
Verifying your result
- Convert the code back to a character (chr in Python, String.fromCharCode in JavaScript) and confirm you get the original symbol.
- Check that the number is between 0 and 127. Anything higher means the character is outside ASCII.
- If a character looks like a normal symbol but returns an unexpected code, it is probably a look-alike from another script or a typographic variant, such as a curly apostrophe instead of the straight ' (39) or a non-breaking space instead of the regular space (32).
- When inspecting a whole string, check each character individually; invisible characters such as tabs, line feeds or trailing spaces will show up as their own codes.
Limits to keep in mind
Tables labeled "extended ASCII" that list codes 128–255 are not part of standard ASCII. Those upper positions vary between legacy code pages, so the same number can mean different characters depending on the system. For anything beyond the basic 128 characters, look up the Unicode code point instead. This guide does not cover or compare specific online ASCII lookup tools, since no tool-specific information was available to evaluate.