How to use it
The full chart is under Every character, 0 to 127: decimal, hex, the character, its name and what each control character does.
To look one up, type into Look up a character, a code or a name:
- one character:
A,é,€, or a single space - a code in any base:
65,0x41,0b1000001,0o101, or an HTML reference likeAorA - a name, abbreviation or everyday word:
line feed,LF,newline,enter,less than sign
A card shows its decimal, hexadecimal, octal and binary values, HTML reference and UTF-8 bytes, and Copy the character copies it. Part of a name, three letters or more, lists every match: feed finds Line Feed and Form Feed.
Examples
newline gives Line Feed (LF), shown as ^J:
Decimal 10
Hexadecimal 0A
Octal 012
Binary 00001010
HTML
UTF-8 bytes 0A
€ is beyond ASCII, so it comes back as code point 8364:
Decimal 8364
Hexadecimal 20AC
Octal 20254
Binary 0010000010101100
HTML €
UTF-8 bytes E2 82 AC
128 is not the euro sign but U+0080, a C1 control with the UTF-8 bytes C2 80. Its HTML row reads None: HTML reads € as a different character. Browsers turn € into € because byte 0x80 is € in Windows-1252.
7 is the digit seven, code 55. For code 7, the bell, type 07, 0x07 or bell.
❤️ is rejected with “❤️” is one character made of 2 code points, 0x2764 and 0xFE0F: look them up one at a time. The second code point is the selector that asks for the emoji style.
Good to know
- ASCII has 128 codes, 0 to 127. It’s a 7-bit code, standardized as ANSI X3.4 and US-ASCII. Codes 32 to 126 print; 0 to 31 and 127 are control characters.
- Caret notation is how terminals show control characters.
^plus the character 64 codes higher: code 3 is^C, code 27 (Escape) is^[, and DEL is^?. Ctrl with that key sends the code, so Ctrl+C sends 3. - Line endings are control characters. Unix ends lines with LF (
\n, 10); Windows uses CR then LF (\r\n, 13 10). - There is no single extended ASCII. Codes 128 to 255 differ by code page: Latin-1, Windows-1252, DOS code page 437. Here, any code above 127 is a Unicode code point; 128 to 255 match Latin-1.
- ASCII text is already UTF-8. Codes 0 to 127 are one byte each in UTF-8, unchanged. Every other code point takes two to four bytes, each from 0x80 up.
- A lookup is up to 40 characters, and code points run from 0 to 0x10FFFF, without the surrogates 0xD800 to 0xDFFF.
Questions
What is the ASCII code for A?
Capital A is 65, or 0x41 in hex; small a is 97, or 0x61. Every capital letter is 32 below its small letter, so the two cases differ by one bit.
How do I convert a character to its ASCII code in code?
In JavaScript, 'A'.codePointAt(0) gives 65, and .toString(16) makes it 41. In Python, ord('A') gives 65 and hex(ord('A')) gives '0x41'; in a shell, printf '%x\n' "'A" prints 41.
What is the difference between ASCII and Unicode?
ASCII is 128 characters; Unicode has room for 1,114,112 code points, and its first 128 are ASCII. UTF-8, the usual way to store Unicode, keeps ASCII text byte for byte.