ESC
Escape
ControlASCII 27 | Hex 0x1B | U+001B
ESC (code 27) begins escape sequences that control terminal behavior. ANSI X3.64 (adopted 1979) standardized sequences like ESC[31m for red text and ESC[2J for screen clear. Every modern terminal emulator supports ANSI escape codes for colors, cursor positioning, and screen manipulation. The Esc key on keyboards generates this character. Vi/Vim uses ESC to switch from insert mode to normal mode, making it one of the most frequently pressed keys in that editor.
ASCII Code
Decimal
27
Hexadecimal
0x1B
Octal
33
Binary
0001 1011
Unicode
Code Point
U+001B
Escape
\u001b
UTF-8 Hex
0xE2 0x90 0x9B
UTF-8 Binary
111000101001000010011011
UTF-16
0x001B
UTF-32
0x0000001B
HTML Entities
Numeric

Hex

How to Type
HTML Entity

Unicode InputU+001B
Source Code Representations
C / Java
"\u001B"CSS
\001BJavaScript
"\u001B"Perl
\x{001B}Python 2
u"\u001B"Python 3
\u001BRuby
\u{001B}Frequently Asked Questions
What is ASCII code 27?
ASCII code 27 represents the Escape character. In hexadecimal it is 0x1B, in binary 0001 1011, and in octal 33. This is a non-printable control character used for device signaling and data transmission control.
How do I type ASCII 27 on a keyboard?
Control characters are typically entered using Ctrl key combinations. For example, Ctrl+[ produces ASCII 27 in most terminal emulators. You can also use the HTML entity  in web pages.