Identify ASCII characters and look up their codes

An ASCII codes chart with decimal and hex values, plus practical ways to check which character you have, spot lookalikes, and know when plain text is the better choice.

An ASCII codes chart answers one narrow question: which number stands for which character. ASCII defines 128 codes, numbered 0 to 127. Of these, 95 are printable (32 to 126, counting the space), and 33 are control codes (0 to 31, plus 127) that were meant to control devices rather than display a glyph. Unicode's first 128 code points match ASCII exactly, so the capital letter A is 65 in ASCII and U+0041 in Unicode. UTF-8 also stores these characters as the same single bytes, which is why ASCII values still matter in modern text.

Is code lookup the right tool for your task?

Looking up a character's code is most useful for diagnosis. It lets you confirm what a character really is when its appearance is ambiguous. The main benefit is certainty: two characters that look identical on screen will have different code points. The decisive tradeoff is readability. Numbers identify characters precisely, but people cannot read them, so codes belong in debugging notes, data cleaning, and documentation, not in text meant for readers.

  • A good fit: finding out why a search, comparison, password field, or parser rejects text that looks correct.
  • A good fit: checking whether a file or field contains only ASCII before passing it to a system that requires it.
  • A good fit: detecting lookalike characters, invisible characters, smart quotes, or nonstandard spaces pasted from other sources.
  • A good fit: writing a character into code or markup where typing it directly is awkward, such as an escape sequence or numeric character reference.
  • Plain text is preferable: whenever the output is meant to be read, searched, or edited by people. Keep the characters themselves and use codes only to explain or verify them.

What looking up a code actually changes

Identifying a character does not change your text. A lookup only reports the number already assigned to the character. The text changes only if you replace characters with codes, such as an escape sequence or HTML reference, or replace codes with characters. This is unrelated to reversed text, mirrored glyphs, or decorative "font" generators. Those effects reorder characters or swap them for different Unicode characters. An ASCII lookup reports values and leaves the text as it was. The same value can be written in several notations, and charts often list more than one.

Notation | Value for capital A | Typical use
Decimal | 65 | ASCII charts, programming functions that return integers
Hexadecimal | 41 | Byte dumps, escape sequences such as \x41
Unicode code point | U+0041 | Unicode references and character inspectors
Binary | 01000001 | Teaching and bit-level work
Octal | 101 | Older escape sequences and some command-line tools
HTML numeric reference | A or A | Web markup

Watch for the term "extended ASCII." Strictly, ASCII stops at 127. Charts that list codes 128 to 255 are showing a particular code page, such as ISO-8859-1 or Windows-1252, and different code pages assign different characters to those numbers. If a chart shows a value above 127, check which encoding it describes before relying on it. In modern UTF-8 text, characters beyond 127 are stored as multiple bytes, so a single value from 128 to 255 does not identify a character on its own.

Looking like ASCII is not the same as being ASCII. Many Unicode characters closely resemble ASCII letters and punctuation. Accented letters can also be stored in two ways: "é" may be a single code point (U+00E9), or a plain "e" (U+0065) followed by a combining acute accent (U+0301). Both look the same, but only the second begins with an ASCII character, and neither form is pure ASCII. The table below lists common substitutions that inspection reveals.

Looks like | Actual character | Code point | ASCII equivalent
a | Cyrillic small letter a (а) | U+0430 | a = 97 (U+0061)
o | Greek small letter omicron (ο) | U+03BF | o = 111 (U+006F)
A | Fullwidth Latin capital A (A) | U+FF21 | A = 65 (U+0041)
" | Left double quotation mark (“) | U+201C | " = 34 (U+0022)
' | Right single quotation mark (’) | U+2019 | ' = 39 (U+0027)
• | En dash (–) | U+2013 | - = 45 (U+002D)
• | Minus sign (−) | U+2212 | - = 45 (U+002D)
space | No-break space | U+00A0 | space = 32 (U+0020)
(nothing visible) | Zero width space | U+200B | none

ASCII codes chart

The first table lists the control codes you are most likely to meet in real text. The second covers every printable ASCII character. Digits and letters run in unbroken sequences, so they are grouped into ranges. Hexadecimal values are shown without a prefix.

Dec | Hex | Abbreviation | Name
0 | 00 | NUL | Null
7 | 07 | BEL | Bell
8 | 08 | BS | Backspace
9 | 09 | HT | Horizontal tab
10 | 0A | LF | Line feed (the line ending on Unix-like systems)
13 | 0D | CR | Carriage return (Windows line endings are CR followed by LF)
27 | 1B | ESC | Escape (starts terminal control sequences)
127 | 7F | DEL | Delete
Dec | Hex | Character | Name
32 | 20 | (space) | Space
33 | 21 | ! | Exclamation mark
34 | 22 | " | Quotation mark
35 | 23 | # | Number sign
36 | 24 | $ | Dollar sign
37 | 25 | % | Percent sign
38 | 26 | & | Ampersand
39 | 27 | ' | Apostrophe
40 | 28 | ( | Left parenthesis
41 | 29 | ) | Right parenthesis
42 | 2A | * | Asterisk
43 | 2B | + | Plus sign
44 | 2C | , | Comma
45 | 2D | - | Hyphen-minus
46 | 2E | . | Full stop
47 | 2F | / | Solidus (slash)
48–57 | 30–39 | 0–9 | Digits (0 = 48, 9 = 57)
58 | 3A | : | Colon
59 | 3B | ; | Semicolon
60 | 3C | < | Less-than sign
61 | 3D | = | Equals sign
62 | 3E | > | Greater-than sign
63 | 3F | ? | Question mark
64 | 40 | @ | Commercial at
65–90 | 41–5A | A–Z | Uppercase letters (A = 65, Z = 90)
91 | 5B | [ | Left square bracket
92 | 5C | \ | Reverse solidus (backslash)
93 | 5D | ] | Right square bracket
94 | 5E | ^ | Circumflex accent (caret)
95 | 5F | _ | Low line (underscore)
96 | 60 | ` | Grave accent (backtick)
97–122 | 61–7A | a–z | Lowercase letters (a = 97, z = 122)
123 | 7B | { | Left curly bracket
124 | 7C | (vertical bar) | Vertical line
125 | 7D | } | Right curly bracket
126 | 7E | ~ | Tilde

Two patterns make the chart easier to use. A lowercase letter's code is always 32 higher than its uppercase partner: A is 65 and a is 97. A digit's code is 48 plus its value: 7 is 55.

How to check what character you have

Some clues suggest a character is not what it seems. Text may fail to match a search or comparison even though it looks identical. A cursor may need an extra keypress to move past a spot that looks empty. Spacing may look slightly off. Quotes or dashes may look typographically "nicer" than what a keyboard produces. In any of these cases, check the code points directly instead of trusting the rendering. The snippets below rely only on standard, documented language features.

In Python, ord() returns a character's code point and chr() converts a number back to a character. The unicodedata module supplies official character names, which is the quickest way to tell lookalikes apart.

import unicodedata

text = "Café “quoted”"
for ch in text:
    cp = ord(ch)
    name = unicodedata.name(ch, "<no name>")
    kind = "ASCII" if cp < 128 else "not ASCII"
    print(f"{ch!r}\t{cp}\tU+{cp:04X}\t{kind}\t{name}")

print(chr(65))          # A
print("hello".isascii())  # True

In JavaScript, use codePointAt() together with a for...of loop, which steps through whole code points. The older charCodeAt() returns UTF-16 code units. For a character outside the Basic Multilingual Plane, such as most emoji, it returns half of a surrogate pair rather than the character's code point.

const text = "Café 👍";
for (const ch of text) {
  const cp = ch.codePointAt(0);
  const hex = "U+" + cp.toString(16).toUpperCase().padStart(4, "0");
  console.log(ch, cp, hex, cp < 128 ? "ASCII" : "not ASCII");
}

// "👍".charCodeAt(0) gives 55357 (a surrogate), not 128077 (U+1F44D)
String.fromCodePoint(97); // "a"

On Linux and many other Unix-like systems, the shell can print a character's value, show a file's raw bytes, or find lines that contain anything other than printable ASCII. In the byte dump, any byte above 7F belongs to a non-ASCII character. The grep pattern also flags tab characters, because tab falls outside the space-to-tilde range.

printf '%d\n' "'A"                  # 65
printf '\x41\n'                     # A
printf 'Café' | xxd                # é appears as the two UTF-8 bytes c3 a9
LC_ALL=C grep -n '[^ -~]' file.txt  # lines containing non-printable-ASCII bytes

If you prefer an online character identifier, useful search terms include "Unicode character inspector," "code point lookup," and "what character is this." No specific site was tested for this article, so none is named. When choosing one, check three things. It should show the code point in U+ notation along with the official character name. It should handle multi-code-point sequences such as combining accents and emoji. And it should reveal invisible characters instead of silently dropping them. A tool's appearance and marketing say nothing reliable about how it handles pasted text, so do not paste passwords, keys, or private data into a web tool. Use a local method instead.

Will the result stay readable after copying or sharing?

Codes written as plain digits are themselves ASCII, so they usually survive copying and pasting intact. The characters being identified are less stable. Word processors and some messaging and publishing tools may convert straight quotes to curly quotes, or hyphens to dashes. Some tools also normalize, strip, or keep invisible characters in ways that vary by destination. None of these behaviors were tested for this article. If exact characters matter, paste the result into the destination and inspect it again with one of the methods above.

For accessibility, raw codes are a poor substitute for text. A screen reader will read "72 105" as numbers, not as "Hi," so any code listing meant for people should include the plain characters next to it. Web markup is different. An HTML numeric reference such as A is converted to the character A when the page is parsed, so readers and assistive technology get the character, not the code. Lookalike characters cause the opposite problem: they look right but may be pronounced oddly or not at all by assistive technology.

For search and editing, a lookalike character breaks matching. A search for "paypal" will not find a version spelled with a Cyrillic а. Replacing such characters with their ASCII equivalents fixes this. Only make that replacement when the original character carried no meaning. Curly quotes in published prose or accented letters in names are intentional, and converting them to ASCII loses information.

Limits of this overview

This article draws on how the ASCII and Unicode standards define these values and on documented behavior of the Python, JavaScript, and shell features shown. It does not include hands-on tests of particular websites, apps, fonts, or screen readers. How a given destination treats pasted quotes, invisible characters, or lookalikes should be checked directly in that environment before you rely on it.