Appearance
ASCII reserves the first 32 code points (numbers 0â31 decimal) and the last one (number 127 decimal) for control characters.
These are codes historically intended to control peripheral devices (such as printers), or to provide meta-information about data streams, such as those stored on magnetic tape. But many of them preserve some uses, particularly when it comes to terminal emulators.
These code points do not represent printable characters (i.e. they are not characters at all, but signals). For debugging purposes, "placeholder" symbols (such as those given in ISO-2047) are assigned to them.
x | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | NUL | SOH | STX | ETX | EOT | ENQ | ACK | BEL | BS | HT | LF | VT | FF | CR | SO | SI |
1 | DLE | DC1 | DC2 | DC3 | DC4 | NAK | SYN | ETB | CAN | EM | SUB | ESC | FS | GS | RS | US |
2 | SP | ! | " | # | $ | % | & | ' | ( | ) | * | + | , | - | . | / |
3 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ; | < | = | > | ? |
4 | @ | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O |
5 | P | Q | R | S | T | U | V | W | X | Y | Z | [ | \ | ] | ^ | _ |
6 | ` | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o |
7 | p | q | r | s | t | u | v | w | x | y | z | { | | | } | ~ | DEL |
0 â Null (NUL) â
- Ctrl-Key:
^@
- C-escape:
\0
- Octal:
\00
- Hex:
\x00
Represents a null character, often used to signify the end of a string.
Originally, in the days of hole-punching, this was intended as a meaningless filler character as it was just a position in which the tape had no holes, and some mechanical devices might be leaving empty NUL
sections to accomodate for the time it took for the mechanism to perform some movements.
1 â Start of Heading (SOH) â
- Ctrl-Key:
^A
- C-escape: none
- Octal:
\01
- Hex:
\x01
Indicates the beginning of a heading in data transmission (not actually meant for headings in documents). The heading will be terminated by a Start of Text (STX) character.
As per ASCII-1968, a heading constitutes a machine-sensible address or routing information. Later standards have dropped the explanation.
2 âĨ Start of Text (STX) â
- Ctrl-Key:
^B
- C-escape: none
- Octal:
\02
- Hex:
\x02
As per ASCII-1968, text is what should be transmitted to a destination. Later standards have dropped the explanation.
3 â End of Text (ETX) â
- Ctrl-Key:
^C
- C-escape: none
- Octal:
\03
- Hex:
\x03
Ends the message text, this doesn't necessarily imply the end of the transmission, footer information might be provided following ETX.
In PC Keyboards, pressing Ctrl+Break
will also send this character.
It has also become standard to use this control code in terminals to interrupt a program or process.
In Unix systems, this means that the signal SIGTERM
will be sent to the running program, which would typically trigger the program to close its buffers and terminate.
4 â End of Transmission (EOT) â
- Ctrl-Key:
^D
- C-escape: none
- Octal:
\004
- Hex:
\x04
In Unix this is also the End of File (EOF) control character, as it's used to signal the termination
Unicode also provides the character â /u2404
as "SYMBOL FOR END OF TRANSMISSION" for when EOT needs to be displayed graphically, although the ISO 2047 representation is that of â /u2301
also identified as "ELECTRIC ARROW".
5 â Enquiry (ENQ) â
- Ctrl-Key:
^E
- C-escape: none
- Octal:
\005
- Hex:
\x05
Also known as "WRU" (stands for 'Who are you?') as commonly labeled on Teletype devices.
This is meant as a "ping" sort of signal, as it's meant to trigger a response at the receiving end, to inquire if it is still present.
6 â Acknowledge (ACK) â
- Ctrl-Key:
^F
- C-escape: none
- Octal:
\006
- Hex:
\x06
By convention a receiving device sends an ACK to indicate it successfully received a message. There's also a NAK code point (character 21) which can be used to indicate the receiving device cannot, or will not, comply with the message.
7 âž Bell (BEL) â
- Ctrl-Key:
^G
- C-escape:
\a
- Octal:
\007
- Hex:
\x07
Also called "alarm bell" or "alert" (ergo the \a
).
Many modern terminals can be configured to trigger the alert condition for their window in the window manager / compositor. This will make the terminal window be shown in a special way by the window manager until focused, to indicate a call for attention / interaction.
8 Backspace (BS) â
- Ctrl-Key:
^H
- C-escape:
\b
- Octal:
\010
- Hex:
\x08
According to the standards, it's meant to move one character position backwards without deleting the previous character. However, its common use is to work as a "delete backwards" operation. Even though originally the BS character would have to be followed by DEL for that.
The original standard behavior was meant for it to act similar to the backspace of mechanical typewriters, which would allow printing devices to overstrike 2 characters, one on top of another. ASCII characters like ´
, ^
and ~
could be followed by a Backspace and then a letter to combine them, for example ´
BS
a
would result in ÃĄ
, or ~
BS
n
result in Ãą
, some other characters in ASCII could be used for underlining (with the underscore _
) or striking (-
or \
).
However, while this was useful for printing devices, most screens did not really support this and later standards abandoned this concept, with ISO-8859 explicitly forbiding overstriking.
9 âĒĢ Horizontal Tabulation (HT) â
- Ctrl-Key:
^I
- C-escape:
\t
- Octal:
\011
- Hex:
\x09
Also called simply "tab" (often uppercase as TAB). It's meant to move the cursor to the next position in an line that's a horizontal tab stop (as designated by the terminal).
10 ⥠Line Feed (LF) â
- Ctrl-Key:
^J
- C-escape:
\n
- Octal:
\012
- Hex:
\x0a
Also called "newline" (ergo the \n
). Moves the cursor to the next line.
11 ⊠Vertical Tabulation (VT) â
- Ctrl-Key:
^K
- C-escape:
\v
- Octal:
\013
- Hex:
\x0b
It's meant to move the cursor to the next vertical position that's a vertical tab stop (as designated by the terminal).
12 ⥠Form Feed (FF) â
- Ctrl-Key:
^L
- C-escape:
\f
- Octal:
\014
- Hex:
\x0c
Also called "New Page (NP)", this was used for what's commonly referred as a "Page Break" when editting documents, meant to indicate that a new page should be fed.
On screens this has been commonly used as a "clear the screen" instruction, Most terminals will clear when Ctrl+L
is pressed.
13 âĒĒ Carriage Return (CR) â
- Ctrl-Key:
^M
- C-escape:
\r
- Octal:
\015
- Hex:
\x0d
Move the cursor to the beginning of the line.
Similar to Backspace, this was originally meant to allow overstriking in printing devices, but also was used in the past in combination with line feed to move to the start of a new line.
You might have (annoyingly) encountered this character when processing files from Unix-like systems that have been originally created in a Microsoft OS like MS Windows or MS DOS. When displaying some files from the terminal you might have seen some weirdly displayed ^M
at the end of each line.
This is because MS-DOS and MS Windows have historically used the combination of \r\n
as the control code to introduce a new line, whereas most Unix-based systems simply use the line feed character \n
by itself as the new line character, without the need for a carriage return \r
.
14 â Shift Out (SO) â
- Ctrl-Key:
^N
- C-escape: none
- Octal:
\016
- Hex:
\x0e
Used to switch to a different character set. Any printable characters (33-126) following this one may be interpreted differently until a Shift In character is reached.
Printers could use this to introduce enlarged fonts, different style/color, etc.
15 â Shift In (SI) â
- Ctrl-Key:
^O
- C-escape: none
- Octal:
\017
- Hex:
\x0f
Used in conjunction with Shift Out. It would restore the original character set to the standard one.
16 â Data Link Escape (DLE) â
- Ctrl-Key:
^P
- C-escape: none
- Octal:
\020
- Hex:
\x10
Changes the meaning of a following character.
17 ⡠Device Control 1 (DC1) â
- Ctrl-Key:
^Q
- C-escape: none
- Octal:
\021
- Hex:
\x11
Meant for device-specific control functions.
DC1
was commonly used to signal XON (resume transmission).
18 âļ Device Control 2 (DC2) â
- Ctrl-Key:
^R
- C-escape: none
- Octal:
\022
- Hex:
\x12
Used for device-specific control functions.
It's function varied depending on the device and system, it did not have a specific common use, but it could be used for custom control operations defined by specific applications or devices.
19 âĩ Device Control 3 (DC3) â
- Ctrl-Key:
^S
- C-escape: none
- Octal:
\023
- Hex:
\x13
Meant for device-specific control functions.
DC3
was commonly used to signal XOFF (pause transmission).
20 â´ Device Control 4 (DC4) â
- Ctrl-Key:
^T
- C-escape: none
- Octal:
\024
- Hex:
\x14
Used for device-specific control functions.
Like DC2
, it's function varied depending on the device and system, it did not have a specific common use, but it could be used for custom control operations defined by specific applications or devices.
21 âģ Negative Acknowledge (NAK) â
- Ctrl-Key:
^U
- C-escape: none
- Octal:
\025
- Hex:
\x15
Negative response. Transmitted from a receiver as a response to the sender.
22 â Synchronization (SYN) â
- Ctrl-Key:
^V
- C-escape: none
- Octal:
\026
- Hex:
\x16
Used to synchronize data streams between devices.
In synchronous communication protocols, SYN
is often sent at the beginning of a transmission block to indicate the start of data. It helps the receiving device to recognize the beginning of a new data frame and to synchronize its clock with the sender's clock.
SYN
can also be used to fill idle time in a communication channel, ensuring that the connection remains active even when there is no data to transmit. This is particularly important in systems where a continuous signal is required to maintain the connection.
23 âŖ End of Transmission Block (ETB) â
- Ctrl-Key:
^W
- C-escape: none
- Octal:
\027
- Hex:
\x17
Indicates the end of a block of data. Used when data is divided into blocks for transmission.
24 ⧠Cancel (CAN) â
- Ctrl-Key:
^X
- C-escape: none
- Octal:
\030
- Hex:
\x18
Indicates that the data preceding it are in error or are to be disregarded.
25 âŋ End of Medium (EM) â
- Ctrl-Key:
^Y
- C-escape: none
- Octal:
\031
- Hex:
\x19
Indicates the end of a medium, such as a tape.
26 âĻ Substitute Character (SUB) â
- Ctrl-Key:
^Z
- C-escape: none
- Octal:
\032
- Hex:
\x1a
This was historically used to replace a character that was found to be invalid or in error. It's meant to be ignored by the printing device.
On Unix, this is used in terminals to send the SIGTSTP
signal that will interrupt the foreground process and place it in suspension.
On MS-DOS, this character was used as End of File (EOF) marker (similar to End of Transmission, EOT, in Unix).
27 â Escape (ESC) â
- Ctrl-Key:
^[
- C-escape:
\e
- Octal:
\033
- Hex:
\x1b
Signals that the subsequent characters should be interpreted differently than their standard meaning. This is often used to introduce special commands or sequences.
One of the most common uses of the ESC character is in ANSI escape codes, which are sequences of characters used to control text formatting, color, and cursor position in terminals and text interfaces.
Note that the escape sequence \e
is not guaranteed to be supported by all languages or compilers, as it's not as commonly used. This is the reason why often on portable scripts many recommend using \033
instead.
On keyboards, the "Escape" key does typically produce an ESC
control character, but nowadays this interpreted as a "cancel current operation" or "go back" sort of function and terminals would not normally input it.
28 â° File Separator (FS) â
- Ctrl-Key:
^\
- C-escape: none
- Octal:
\034
- Hex:
\x1c
Separates files or sections within a data stream. It is often used in data interchange formats to separate distinct files or datasets.
In applications that process multiple files or datasets within a single stream, FS can be used to mark where one file ends and the next begins.
29 âą Group Separator (GS) â
- Ctrl-Key:
^]
- C-escape: none
- Octal:
\035
- Hex:
\x1d
Separates groups of data within a file or dataset. It can be used to logically group related records or fields together.
GS
is useful in hierarchical data structures where records need to be grouped into higher-level categories or sets.
30 ⲠRecord Separator (RS) â
- Ctrl-Key:
^^
- C-escape: none
- Octal:
\036
- Hex:
\x1e
Separates records or entries within a file or dataset. It is analogous to a newline character but is used specifically for separating structured records.
RS
is commonly used in databases and data interchange formats to separate individual records, allowing for clear delineation between entries.
31 âŗ Unit Separator (US) â
- Ctrl-Key:
^_
- C-escape: none
- Octal:
\037
- Hex:
\x1f
Separates units or fields within a record. It is the most granular of the separators, used to distinguish individual data elements within a larger structure.
US
is useful in data formats where fields need to be clearly separated, such as in tabular data or complex records with multiple attributes.
32 âŗ Space (SP) â
- Ctrl-Key: none
- C-escape: none
- Octal:
\038
- Hex:
\x20
Just a blank space that we commonly use to separate words in a sentence. Sometimes it's also represented with the âŖ
character.
Although commonly considered an invisible "non-printable" character, strictly it is not technically part of the C0 control character set (ASCII codes 0 to 31). Instead, SP
is technically considered part of the printable character set and represents the space character, which is typically generated by pressing the spacebar on a keyboard.
127 ⨠Delete (DEL) â
- Ctrl-Key:
^?
- C-escape: none
- Octal:
\0177
- Hex:
\x7f
Used to "delete" or ignore a character.
Interestingly, in early computing, the DEL character was often represented as a series of punched holes on paper tape, which would physically remove the character when the tape was read. This made it a literal "delete" operation, physically erasing the previous character. It was placed last in the 7 bit sequence (1111111
) so it would punch all holes.