Reference:ASCII Table

From CoderGuide

Jump to: navigation, search


ASCII Table

Where you see a '\x' sequence, that is the C escape sequence for that character. It also happens to be used a lot in other languages, including Perl, and the Unix shells (in certain places). Codes 0-31 are special control characters. Characters beyond 127 are not defined by the ASCII standard, and are used to represent different characters depending on the character set. Where you see ^X is the control sequence for that character, in other words, holding down CTRL-X would be ^X. You'll see these sequences if trying to edit a binary file with something like Vim, and in other places.


ValueSymbol^nValueSymbolValueSymbolValueSymbol
0NUL '\0'^@32SPACE64@96`
1SOH^A33!65A97a
2STX^B34"66B98b
3ETX^C35#67C99c
4EOT^D36$68D100d
5ENQ^E37%69E101e
6ACK^F38&70F102f
7BEL '\a'^G39'71G103g
8BS '\b'^H40(72H104h
9HT '\t'^I41)73I105i
10LF,NL '\n'^J42*74J106j
11VT '\v'^K43+75K107k
12FF,NP '\f'^L44,76L108l
13CR '\r'^M45-77M109m
14SO^N46.78N110n
15SI^O47/79O111o
16DLE^P48080P112p
17DC1^Q49181Q113q
18DC2^R50282R114r
19DC3^S51383S115s
20DC4^T52484T116t
21NAK^U53585U117u
22SYN^V54686V118v
23ETB^W55787W119w
24CAN^X56888X120x
25EM^Y57989Y121y
26SUB^Z58:90Z122z
27ESC^[59;91[123{
28FS^\60<92\124|
29GS^]61=93]125}
30RS^^62>94^126~
31US^-63?95_127DEL

Special Codes

These codes had a significant meaning at one point in type, but aren't used too much anymore, except for the obvious BS, NL,CR, FF (less important now), ESC, NUL, and TAB. BEL also has it's uses, and will still ring a bell on most systems when displayed under a terminal emulator or command promt (even Windows/DOS COMMAND.COM/CMD.EXE)

CodeExplanation
NULNull character, or zero, normally doesn't display. Used as the terminator for C strings (aka null-terminated strings). In the past, null characters were sometimes used to delay a terminal while sending a continous string of characters, for instance, when displaying ANSI animation sequences
SOHStart of Heading
STXStart of Text
ETXEnd of Text
EOTEnd of Transmission
ENQEnquiry
ACKAcknowledge
BELBell, ring the terminal's bell
BSBackspace, move cursor back one space. Sometimes sent when the backspace, or delete key is pressed (depending on terminal's settings). Will move the cursor head back on printers (when printing ASCII files) and often used to make bold text on printers that otherwise don't have that ability. When sent to a terminal, will move the cursor back, and may or may not destroy the text underneath.
HTHorizontal tab. Same as if you hit the tab key on your keyboard. Moves cursor to the next tab stop on a terminal (typically set at every 8 character intervals)
LF,NLLine feed/New line, used to terminate lines in Unix text files (and on Mac OS X, which is Unix based). MS-DOS and Windows programs, like Notepad, expect the line to be terminated with a CR/LF pair. LF moves the cursor down one line, but does not return the cursor to the first column on printers and terminals.
VTVertical tab (usually not on a keyboard)
FF,NPForm feed/New Page. Tells the printer to spit out a page. Used to mark the end of pages for printing. Some terminals will clear the screen when it is sent to the display.
CRCarriage return. This is often the code that is sent when the Return/Enter key is pressed. Used to terminate Mac (not OS X) and older Apple text files. MS-DOS and windows expects CR/LF pairs. Returns the cursor to the first column, does not move cursor down one line.
SOShift Out
SIShift In
DLEData Link Escape
DC1Device Control 1
DC2Device Control 2
DC3Device Control 3
DC4Device Control 4
NAKNegative Acknowledge
SYNSync
ETBend of transfer block
CANCancel transmission
EMend of medium
SUBsubstitute
ESCEscape (starts escape codes, sent when pressing the Esc key)
FSfile separator
GSgroup separator
RSrecord separator
USunit separator
DELDelete, sent sometimes in place of the backspace key on terminal keyboards.
Personal tools