Article

ANSI.SYS Documentation and Referene

    Back to ASCII Art Academy

This reference documentation was written and published by Carsten Cumbrowski aka Roy/SAC in March 2014.

Table of Contents

  1. ANSI Color Codes
  2. ANSI Escape Sequences (Brief)
    1. Set Display Attributes
  3. ANSI Escape Sequences Programming (Detailed)
    1. Cursor Commands
    2. Erase Commands
    3. Display Attribute and Mode Commands
    4. Keyboard Commands
  4. Notes
    1. Entering the {ESC} Character
    2. Enabling ANSI.SYS
    3. Using ANSI.SYS Escape Sequences
  5. ANSI.SYS Examples
    1. Batch File
    2. Command Prompt
    3. Text File Example
  6. ANSI.SYS Key and Extended Key Codes
  7. ANSI Colors mapped to HTML color codes etc.
  8. ASCII Standard Character Set
  9. ASCII Extended Character Sets
  10. Character Entities in HTML 4
    1. Latin-1 Characters
    2. Mathematical, Greek and Symbolic Characters
    3. Special Characters

ANSI Color Codes

Pueblo/UE supports a wide range of ANSI color codes. This is a list of those codes currently supported by Pueblo/UE, together with which client version they were introduced in. If the version is shown as "--", then it was introduced in version 2.01 or earlier (exact information is not available).

An ANSI code is sent by the world by sending an escape character (ESC, ASCII value 27) followed by the appropriate code sequence:

Code: Client: Meaning:
[0m -- reset; clears all colors and styles (to white on black)
[1m -- bold on (see below)
[3m -- italics on
[4m -- underline on
[7m 2.50 inverse on; reverses foreground & background colors
[9m 2.50 strikethrough on
[22m 2.50 bold off (see below)
[23m 2.50 italics off
[24m 2.50 underline off
[27m 2.50 inverse off
[29m 2.50 strikethrough off
[30m -- set foreground color to black
[31m -- set foreground color to red
[32m -- set foreground color to green
[33m -- set foreground color to yellow
[34m -- set foreground color to blue
[35m -- set foreground color to magenta (purple)
[36m -- set foreground color to cyan
[37m -- set foreground color to white
[39m 2.53 set foreground color to default (white)
[40m -- set background color to black
[41m -- set background color to red
[42m -- set background color to green
[43m -- set background color to yellow
[44m -- set background color to blue
[45m -- set background color to magenta (purple)
[46m -- set background color to cyan
[47m -- set background color to white
[49m 2.53 set background color to default (black)

The bold codes have been given two different interpretations:
In client version 2.01 and earlier, bold was interpreted as the physical bold style - equivalent to the HTML <b> tag. In addition, the code [2m was mistakenly interpreted as bold off and the correct code was not handled.

In version 2.50 and later, bold is interpreted as 'high-intensity', which was the original ANSI definition. (High-intensity colors are brighter than low-intensity ones, which are the default.) If you want the bold font style, you will have to use the <b> tag instead. The incorrect [2m code for bold off is supported for backwards compatibility, along with the correct [22m code.

In addition, the ASCII BEL character (value 7) is internally translated to the HTML sequence <img xch_alert>. This will cause an audible alert sound, if configured to do so in the Preferences. While this is not actually an ANSI code sequence, worlds usually group this with them.

 

ANSI Escape Sequences (Brief)

Wherever you see '#', that should be replaced by the appropriate number.

ESC code sequence Function
Cursor Controls:
{ESC}[#;#H or
{ESC}[#;#f

Moves cusor to line #, column #

{ESC}[#A

Moves cursor up # lines

{ESC}[#B

Moves cursor down # lines

{ESC}[#C

Moves cursor forward # spaces

{ESC}[#D

Moves cursor back # spaces

{ESC}[#;#R

Reports current cursor line & column

{ESC}[s

Saves cursor position for recall later

{ESC}[u

Return to saved cursor position

Erase Functions:
{ESC}[0J or {ESC}[J

clear from cursor to end of screen

{ESC}[1J

clear from cursor to beginning of the screen

{ESC}[2J

Clear screen and home cursor (moves cursor to upper left)

{ESC}[0K or {ESC}[K

Clear to end of line

{ESC}[1K

clear from cursor to beginning of the line

{ESC}[2K

clear entire line. Cursor position does not change

Set Graphics Rendition:
{ESC}[#;#;....;#m Set display attributes where # is
00 for normal display (or just 0)
01 for bold on (or just 1)
02 faint (or just 2)
03 standout (or just 3)
04 underline (or just 4)
05 blink on (or just 5)
07 reverse video on (or just 7)
08 nondisplayed (invisible) (or just 8)
22 normal
23 no-standout
24 no-underline
25 no-blink
27 no-reverse
30 black foreground
31 red foreground
32 green foreground
33 yellow foreground
34 blue foreground
35 magenta foreground
36 cyan foreground
37 white foreground
39 default foreground
40 black background
41 red background
42 green background
43 yellow background
44 blue background
45 magenta background
46 cyan background
47 white background
49 default background
{ESC}[=#;7h or
{ESC}[=h or
{ESC}[=0h or
{ESC}[?7h

Put screen in indicated mode where # is
0 for 40 x 25 black & white
1 for 40 x 25 color
2 for 80 x 25 b&w
3 for 80 x 25 color
4 for 320 x 200 color graphics
5 for 320 x 200 b & w graphics
6 for 640 x 200 b & w graphics
7 to wrap at end of line

{ESC}[=#;7l or
{ESC}[=l or
{ESC}[=0l or
{ESC}[?7l
Resets mode # set with above command
Keyboard Reassignments:
{ESC}[<row>A or
{ESC}[#;#;...p or
{ESC}["string"p or
{ESC}[#;"string";#;#;"string";#p

Keyboard reassignment. The first ASCII code defines which code is to be changed. The remaining codes define what it is to be changed to.

E.g. Reassign the Q and q keys to the A and a keys (and vice versa).

{ESC}[65;81pA becomes Q
{ESC}[97;113pa becomes q
{ESC}[81;65pQ becomes A
{ESC}[113;97pq becomes a

E.g. Reassign the F10 key to a DIR command.

{ESC}[0;68;"dir";13p The 0;68 is the extended ASCII code for the F10 key and 13 is the ASCII code for a carriage return.

Other function key codes: F1=59,F2=60,F3=61,F4=62,F5=63,F6=64,F7=65,F8=66,F9=67,F10=68
 

Set Display Attributes

{ESC}[{attr1};...;{attrn}m Sets multiple display attribute settings. The following lists standard attributes:
General Atributes
ValueDescription
0Reset all attributes
1Bright
2Dim
4Underscore
5Blink
7Reverse
8Hidden
 
Foreground Colours
ValueDescription
30Black
31Red
32Green
33Yellow
34Blue
35Magenta
36Cyan
37White
 
Background Colours
ValueDescription
40Black
41Red
42Green
43Yellow
44Blue
45Magenta
46Cyan
47White
 

ANSI Escape Sequences Programming (Detailed)

Cursor Commands

Cursor Up

{ESC}[<row>A Moves the cursor up the specified number of rows without changing the column.

<row> is a number from 1 through 24 that specifies how many rows the cursor is to be moved up. If you omit <row>, DOS moves the cursor up one row.

Examples

{ESC}[13A

Move the cursor up 13 rows

{ESC}[A

Move the cursor up 1 row

Cursor Down

{ESC}[<row>B Moves the cursor down the specified number of rows without changing the column.

<row> is a number from 1 through 24 that specifies how many rows the cursor is to be moved down. If you omit <row>, DOS moves the cursor down one row.

Examples

{ESC}[8B

Move the cursor down eight rows.

{ESC}[B

Move the cursor down one row.

Cursor Right

{ESC}[<col>C Moves the cursor right the specified number of columns without changing the row.

<col> is a number from 1 through 79 that specifies how many columns that cursor is to be moved right. If you omit <col>, DOS moves the cursor right one column.

Examples

{ESC}[40C

Move the cursor right 40 columns.

{ESC}[C

Move the cursor right one column.

Cursor Left

{ESC}[<col>D Moves the cursor left the specified number of columns without changing the row.

<col> is a number from 1 through 79 that specifies how many columns the cursor is to be moved left. If you omit <col>, DOS moves the cursor left one column.

Examples

{ESC}10[D

Move the cursor left ten columns.

{ESC}[D

Move the cursor left one column.

Move Cursor

{ESC}[<row>;<col>H or
{ESC}<row>;<col>f
Moves the cursor to the specified row and column.

<row> is a number from 1 through 25 that specifies the row to which the cursor is to be moved. If you omit <row>, DOS moves the cursor to row 1. To omit <row> but specify <col>, enter the semicolon to show the <row> is omitted.

<col> is a number from 1 through 80 that specifies the column to which the cursor is to be moved. If you omit <col>, DOS moves the cursor to column 1.

If you omit both <row> and <col>, DOS moves the cursor to the home position (row 1, column 1--the upper left corner of the screen).

Examples

{ESC}[;10H

Move the cursor to column 10, row 1.

{ESC}[H

Move the cursor to row 1, column 1.

Save Cursor Position

{ESC}[s Stores the current row and column position of the cursor.

You can move the cursor to this location with a Restore Cursor Position command.

Examples

{ESC}[s

Save the current cursor position.

Report Cursor Position

{ESC}[6n Returns the current row and column position of the cursor in the form {ESC}[<row>;<col>R.

<row> is a number from 1 through 25 that specifies the row where the cursor is located. <col> is a number from 1 through 80 that specifies the column where the cursor is located.

Examples

{ESC}[6n

Report the current cursor position.

Restore Cursor Position

{ESC}[u Moves the cursor to the row and column position most recently saved with a Save Cursor Position command.
Examples

{ESC}[u

Move the cursor the row and column last saved with a Save Cursor Position command.

 

Erase Commands

Erase Display

{ESC}[0J or {ESC}[J Clear from Current Cursor Position to End-of-Screen
{ESC}[1J Clear from Current Cursor Position to Beginning of the Screen.
{ESC}[2J Erases the entire display (equivalent to the DOS Clear Screen or cls command).
Examples

{ESC}[2J

Erase the screen.

Erase Line

{ESC}[0K or {ESC}[K Erases from the current cursor position through the end of the line that contains the cursor.
{ESC}[1K Clear from Current Cursor Position to Beginning of the Current Line.
{ESC}[2K Clear Entire Current Line. Current Cursor Position remains unchanged.
Examples

{ESC}[K

Erase from the cursor to the end of the line.

 

Display Attribute and Mode Commands

Set Attribute

{ESC}[<attr>m Turns on a characteristic or attribute of the display, such as high intensity, blink, or foreground and background color.

<attr> specifies the display attribute to be turned on. More than one attribute can be specified by using a semicolon to separate the attribute numbers. <attr> can be any of the following:

Text Attribute Value
None 0
High Intensity (bold) 1
Underline (monochrome display only) 4
Blink 5
Reverse 7
Invisible 8
 
Color Attr. Foregr.Val. Backgr.Val.
Black 30 40
Red 31 41
Green 32 42
Yellow 33 43
Blue 34 44
Magenta 35 45
Cyan 36 46
White 37 47

If you omit <attr>, all attributes are turned off (equivalent to specifying <attr> as 0).

Examples

{ESC}[1m

High intensity.

{ESC}[1;5m

High intensity and blink.

{ESC}[30;46m

Black foreground, cyan background.

{ESC}[m

Turn off all attributes.

{ESC}[0m

Turn off all attributes.

{ESC}[0;1;36m

Turn off all attributes, then turn on high-intensity cyan foreground.

Set Display Mode

{ESC}[=<mode>h Sets the width and color capability of the display (generally equivalent to the DOS MODE command). This command can also be used to cause lines longer than 80 characters to be broken at the 80th character and continued on the next line, rather than truncated at the 80th column; this is called line wrap. It can be turned off with the Turn Off Line Wrap command. Note the equal sign (=) that precedes <mode>.

<mode> specifies the display mode. It can be one of the following:

Display ModeValue

40 columns by 25 rows, black and white

0

40 columns by 25 rows, color on

1

80 columns by 25 rows, black and white 2
80 columns by 25 rows, color on 3
320 by 200 graphics, color on 4
320 by 200 graphics, black and white 5
640 by 200 graphics, black and white 6
Turn on line wrap 7
Examples

{ESC}[=1h

Set the display to 40 by 25 color on.

{ESC}[=7h

Continued lines longer than 80 characters, don't truncate them.

Turn Off Line Wrap

{ESC}[=7lCauses lines longer than 80 characters to be truncated at the 80th character, rather than continued to the next line.
Examples

{ESC}[=7l

Truncate lines longer than 80 characters.

 

Keyboard Commands

Define Key

{ESC}[<key code>;<result>p Assigns one or more characters to be produced when you press a key.

<key code> specifies the key to be defined. If the key is one of the standard ASCII characters, <key code> is a number from 1 through 127. If the key is a function key, keypad key, or a combination of the <Shift>, <Ctrl>, or <Alt> key and another key, <key code> is two numbers separated by a semicolon and can be found in the ANSI.SYS key code table.

<result> is the character or characters to be produced when a key is pressed. It can be specified as an ASCII code, an ANSI.SYS key code, a string enclosed in quotation marks, or any combination of codes and strings separated by semicolons. To restore a key to its original meaning, enter a Define Key command that sets <result> equal to <key code>.

Examples

{ESC}[126;92p

Redefine the tilde <~> key as a backslash <\>.

{ESC}[126;126p

Restore the tilde <~> key to its original meaning.

{ESC}[0;112;"dir|sort";13p

Redefine <Alt><F9> as a Directory command piped to a Sort command, followed by a Carriage Return.

{ESC}[0;112;0;112p

Restore <Alt><F9> to its original meaning.

 

Notes

Entering the {ESC} Character

  • In DOS: Press and hold the <Alt> key, then type 27 on the keypad.
  • In Windows: Press and hold the <Alt> key, then type 0027 on the keypad.
  • Exceptions: Sometimes the above keystrokes do not work. Try one of the following methods:
    • In MS-DOS EDITOR and QBASIC, type any one of these:
      • <Ctrl>P, <Alt>027
      • <Ctrl>P, <Ctrl>[
      • <Ctrl>P, <Esc>
    • In Microsoft WORD, use a macro:
      • Sub AsciiEscChar() 'Insert ASCII Esc character. Selection.TypeText Chr(027) End Sub
      • Save the file as "Text Only" or "MS-DOS Text".
    • In Microsoft NOTEPAD and WORDPAD:
      • Copy the {ESC} character from another text file and paste it into the document.

Enabling ANSI.SYS

Before using escape seqences, ANSI.SYS must be named as a device driver in the CONFIG system file.

For Windows 95, Windows 98 and DOS:

  • Create or edit the CONFIG.SYS file. (Found in the root directory.)
  • Add the following line to the file:

DEVICE=<path>\ANSI.SYS where <path> is the full path of the ANSI.SYS file. (Usually found in the WINDOWS directory.)

  • Save CONFIG.SYS with the new line.
  • Check that a copy of ANSI.SYS exists in the specified path location.
  • Restart the computer to complete the change.

For Windows NT, Windows 2000 and Windows XP:

  • Create or edit the CONFIG.NT file. (Usually found in the WINNT\SYSTEM32 directory.)
  • Add the following line to the file:

DEVICE=%systemroot%\system32\ANSI.SYS

  • Save CONFIG.NT with the new line.
  • Check that a copy of ANSI.SYS exists in the specified path location.
  • Restart the computer to complete the change.

Restrictions:

  • Windows NT does not support ANSI.SYS escape sequences in Win32 Console applications.
  • The Windows 2000/NT Command Interpreter, CMD.EXE, does not support ANSI.SYS. Use COMMAND.COM instead.

Using ANSI.SYS Escape Sequences

Because ANSI.SYS commands control the console device, they must be typed at the keyboard or sent to the display.

  • Put the ANSI.SYS commands in a file and display the file with the TYPE or COPY command.
  • Use the PROMPT command with the command prompt code, $e.

Example:

prompt $e[1;37;44m (Set the text color to bright white and the screen color to blue.)

  • Use the ECHO command in a batch file.

Example:

echo {ESC}[8;26H (Move the cursor to row 8, column 26.)

To execute a batch file containing ANSI commands in Windows 2000/NT, use one of the following methods:

  • Open a DOS command prompt window and type the <batch path>.
  • Type %SystemRoot%\system32\COMMAND.COM /c <batch path> at the Run command line.
  • Create a program information file (PIF) by making a shortcut of COMMAND.COM, then set the Cmd Line property to the <batch path> and the Advanced Program properties to %SystemRoot%\system32\AUTOEXEC.NT and %SystemRoot%\system32\CONFIG.NT.
  • Use the WRITE, PRINT or a similiar command in FORTRAN, C, BASIC, etc.

Example:

WRITE(*,*)'{ESC}[2J' (Clear the screen.)

 

ANSI.SYS Examples

Batch File

SCREEN.BAT demonstrates some Display Attribute and Cursor commands.

  • Download as a zipped file.
  • Display as a text file.
  • View a screen shot.

Command Prompt

Type the line below in a COMMAND.COM window to change the DOS command prompt.

  • prompt=$_$d$_$t$h$h$h$_$e[1;37;43mMy Computer$e[44m $p$g
  • View a screen shot.

Text File Example

@echo off
echo [0;1;37;40m[2J
echo SCREEN.BAT demostrates some of the Display Attribute commands
echo            from ANSI Escape Sequences
echo.
echo Each row is numbered with a foreground color.
echo Each column is numbered with a background color.
rem 14 spaces between Normal and High Intensity in next line.
echo [8;26HNormal              High Intensity
rem Five spaces between 7 and 0 in next line.
echo [9;26H0 1 2 3 4 5 6 7     0 1 2 3 4 5 6 7
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;24H%%c
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;26H[0;3%%c;40mXX[18C[1mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;28H[0;3%%c;41mXX[18C[1mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;30H[0;3%%c;42mXX[18C[1mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;32H[0;3%%c;43mXX[18C[1mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;34H[0;3%%c;44mXX[18C[1mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;36H[0;3%%c;45mXX[18C[1mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;38H[0;3%%c;46mXX[18C[1mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;40H[0;3%%c;47mXX[18C[1mXX
echo [0;1;37;40m
echo.
pause
echo [8;26HNormal              Underline[K
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;26H[0;3%%c;40mXX[18C[4mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;28H[0;3%%c;41mXX[18C[4mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;30H[0;3%%c;42mXX[18C[4mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;32H[0;3%%c;43mXX[18C[4mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;34H[0;3%%c;44mXX[18C[4mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;36H[0;3%%c;45mXX[18C[4mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;38H[0;3%%c;46mXX[18C[4mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;40H[0;3%%c;47mXX[18C[4mXX
echo [0;1;37;40m
echo.
pause
echo [8;26HNormal              Blink[K
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;26H[0;3%%c;40mXX[18C[5mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;28H[0;3%%c;41mXX[18C[5mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;30H[0;3%%c;42mXX[18C[5mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;32H[0;3%%c;43mXX[18C[5mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;34H[0;3%%c;44mXX[18C[5mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;36H[0;3%%c;45mXX[18C[5mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;38H[0;3%%c;46mXX[18C[5mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;40H[0;3%%c;47mXX[18C[5mXX
echo [0;1;37;40m
echo.
pause
echo [8;26HNormal              Reverse[K
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;26H[0;3%%c;40mXX[18C[7mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;28H[0;3%%c;41mXX[18C[7mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;30H[0;3%%c;42mXX[18C[7mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;32H[0;3%%c;43mXX[18C[7mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;34H[0;3%%c;44mXX[18C[7mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;36H[0;3%%c;45mXX[18C[7mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;38H[0;3%%c;46mXX[18C[7mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;40H[0;3%%c;47mXX[18C[7mXX
echo [0;1;37;40m
echo.
pause
echo [8;26HNormal              Invisible[K
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;26H[0;3%%c;40mXX[18C[8mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;28H[0;3%%c;41mXX[18C[8mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;30H[0;3%%c;42mXX[18C[8mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;32H[0;3%%c;43mXX[18C[8mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;34H[0;3%%c;44mXX[18C[8mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;36H[0;3%%c;45mXX[18C[8mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;38H[0;3%%c;46mXX[18C[8mXX
for %%c in (0 1 2 3 4 5 6 7) do echo [1%%c;40H[0;3%%c;47mXX[18C[8mXX
echo [0;1;37;40m
echo.
echo [K

 

ANSI.SYS Key and Extended Key Codes

KeyCodeShift-Ctrl-Alt- KeyCodeShift-Ctrl-Alt-
a [A]976510;30 F10;590;840;940;104
b [B]986620;48 F20;600;850;950;105
c [C]996730:46 F30;610;860;960;106
d [D]1006840;32 F40;620;870;970;107
e [E]1016950;18 F50;630;880;980;108
f [F]1027060;33 F60;640;890;990;109
g [G]1037170;34 F70;650;900;1000;110
h [H]1047280;35 F80;660;910;1010;111
i [I]1057390;23 F90;670;920;1020;112
j [J]10674100;36 F100;680;930;1030;113
k [K]10775110;37 F110;1330;1350;1370;139
l [L]10876120;38 F120;1340;1360;1380;140
m [M]10977130;50 Esc27  0;1
n [N]11078140;49 PrtScrn  0;114 
o [O]11179150;24 Home0;71550;1190;151
p [P]11280160;25 Up Arrow0;7256 0;152
q [Q]11381170;16 PageUp0;73570;1320;153
r [R]11482180;19 Left Arrow0;75520;1150;155
s [S]11583190;31 Right Arrow0;77540;1160;157
t [T]11684200;20 End0;79490;1170;159
u [U]11785210;22 Down Arrow0;8050 0;160
v [V]11886220;47 PageDown0;81510;1180;161
w [W]11987230;17 Insert0;8248 0;162
x [X]12088240;45 Delete0;8346 0;163
y [Y]12189250;21 Home [7]0;71550;119 
z [Z]12290260;44 Up Arrow [8]0;72560;141 
1 [!]4933 0;120 PgUp [9]0;73570;132 
2 [@]5064 0;121 Left Arrow [4]0;75520;115 
3 [#]5135 0;122 Right Arrow [6]0;77540;116 
4 [$]5236 0;123 End [1]0;79490;117 
5 [%]5337 0;124 Down Arrow [2]0;80500;145 
6 [^]5494 0;125 PgDn [3]0;81510;118 
7 [&]5538 0;126 Ins [0]0;82480;146 
8 [*]5642 0;127 Del [.]0;83460;147 
9 [(]5740 0;128 [5]53530;143 
0 [)]4841 0;129 * (keypad)42 0;1500;55
- [_]4595 0;130 + (keypad)43 0;1440;78
= [+]6143 0;131 - (keypad)45 0;1420;74
Backspace127  0;14 / (keypad)47 0;1490;164
Enter13  0;28 Enter (keypad)13 0;1660;166
Tab90;150;1480;165 Null0;3   
 

Notes

[1] Standard Codes are single-byte numbers.

[2] Extended Codes are two-byte numbers. Extended codes always begin with zero.

 

ANSI Colors mapped to HTML color codes etc.

Fore Ground Colors Background Colors Color Name HTML
Bold Attribute Color Attribute Bold Attribute Color Attribute
0 30 0 40 Black #000000  
0 31 0 41 Dark Red #AA0000  
0 32 0 42 Dark Green #00AA00  
0 33 0 43 Brown #AA5500  
0 34 0 44 Dark Blue #0000AA  
0 35 0 45 Dark Magenta #AA00AA  
0 36 0 46 Dark Cyan #00AAAA  
0 37 0 47 Gray #AAAAAA  
1 30 - - Dark Gray #555555  
1 31 - - Red #FF5555  
1 32 - - Green #55FF55  
1 33 - - Yellow #FFFF55  
1 34 - - Blue #5555FF  
1 35 - - Magenta #FF55FF  
1 36 - - Cyan #55FFFF  
1 37 - - White #FFFFFF  

Here is the same mapping, but grouped differently as it is used in ANSI Editors such as TheDraw, AcidDraw or PabloDraw.

# Color Name HTML Hex R,G,B ESC # Color Name HTML Hex R,G,B ESC
00 Black #000000   0,   0,   0 [0;30m 01 Dark Blue #0000AA   0,   0, 170 [0;34m
02 Dark Green #00AA00   0, 170,   0 [0;32m 03 Dark Cyan #00AAAA   0, 170, 170 [0;36m
04 Dark Red #AA0000 170,   0,   0 [0;31m 05 Purple/Dark Magenta #AA00AA 170,   0, 170 [0;35m
06 Brown #AA5500 170, 85,   0 [0;33m 07 Gray #AAAAAA 170, 170, 170 [0;37m
08 Dark Gray #555555  85,  85,  85 [1;30m 09 Blue #5555FF  85,  85, 255 [1;34m
10 Green #55FF55  85, 255,  85 [1;32m 11 Cyan #55FFFF  85, 255, 255 [1;36m
12 Red #FF5555 255,  85,  85 [1;31m 13 Light Purple/Magenta #FF55FF 255,  85, 255 [1;35m
14 Yellow #FFFF55 255, 255,  85 [1;33m 15 White #FFFFFF 255, 255, 255 [1;37m

Note: The for the ESC sequence must be replaced with the ASCII character for "Escape" (Chr(27)).

 

ASCII Standard Character Set

CharCtrlDecHex CharDecHex CharDecHex CharDecHex
NUL^@000 <space>3220 @6440 `9660
SOH^A101 !3321 A6541 a9761
STX^B202 "3422 B6642 b9862
ETX^C303 #3523 C6743 c9963
EOT^D404 $3624 D6844 d10064
ENQ^E505 %3725 E6945 e10165
ACK^F606 &3826 F7046 f10266
BEL^G707 '3927 G7147 g10367
BS^H808 (4028 H7248 h10468
HT^I909 )4129 I7349 i10569
LF^J100A *422A J744A j1066A
VT^K110B +432B K754B k1076B
FF^L120C ,442C L764C l1086C
CR^M130D -452D M774D m1096D
SO^N140E .462E N784E n1106E
SI^O150F /472F O794F o1116F
DLE^P1610 04830 P8050 p11270
DC1^Q1711 14931 Q8151 q11371
DC2^R1812 25032 R8252 r11472
DC3^S1913 35133 S8353 s11573
DC4^T2014 45234 T8454 t11674
NAK^U2115 55335 U8555 u11775
SYN^V2216 65436 V8656 v11876
ETB^W2317 75537 W8757 w11977
CAN^X2418 85638 X8858 x12078
EM^Y2519 95739 Y8959 y12179
SUB^Z261A :583A Z905A z1227A
ESC^[271B ;593B [915B {1237B
FS^\281C <603C \925C |1247C
GS^]291D =613D ]935D }1257D
RS^^301E >623E ^945E ~1267E
US^_311F ?633F _955F <delete>1277F
 

Notes

ASCII (American Standard Code for Information Interchange) is a 7-bit character code that was introduced by American National Standards Institute (ANSI) and is used by most U.S. personal and workstation computers.

 

ASCII Extended Character Sets

ASCII Extended Character Sets, PC

Typing an ASCII character

In DOS:

Hold down the <Alt> key while typing the decimal number on the keyboard keypad. (Example: <Alt>178)

In Windows for a DOS character:

Hold down <Alt> while typing the decimal on the keyboard keypad. (Example: <Alt>230)

In Windows for a WIN character:

Hold down <Alt> while typing "0" then the decimal number on the keyboard keypad. (Example: <Alt>0140)

 

ASCII Extended Character Set, Macintosh

Typing an ASCII character

Keystroke Abbreviations:

<op> Option key
<sh> Shift key
<sp> Space bar

Keystroke Examples:

<op><sh>a Hold down the Option, Shift and "a" keys simultaneously, then release the keys.

<op>c Hold down the Option and "c" keys simultaneously, then release.

<op>e E Hold down the Option and "e" keys simultaneously, release, then type a capital "

 

Character Entities in HTML 4

Latin-1 , Mathematical, Greek and Symbolic , Special

 

Latin-1 Characters

CodeEntityCharacterDescription
&#160;&nbsp; non-breaking space
&#161;&iexcl;¡inverted exclamation mark
&#162;&cent;¢cent sign
&#163;&pound;£pound sterling sign
&#164;&curren;¤general currency sign
&#165;&yen;¥yen sign
&#166;&brvbar;¦broken (vertical) bar
&#167;&sect;§section sign
&#168;&uml;¨umlaut (dieresis)
&#169;&copy;©copyright sign
&#170;&ordf;ªordinal indicator, feminine
&#171;&laquo;«angle quotation mark, left
&#172;&not;¬not sign
&#173;&shy;­soft hyphen
&#174;&reg;®registered sign
&#175;&macr;¯macron
&#176;&deg;°degree sign
&#177;&plusmn;±plus-or-minus sign
&#178;&sup2;²superscript two
&#179;&sup3;³superscript three
&#180;&acute;´acute accent
&#181;&micro;µmicro sign
&#182;&para;pilcrow (paragraph sign)
&#183;&middot;·middle dot
&#184;&cedil;¸cedilla
&#185;&sup1;¹superscript one
&#186;&ordm;ºordinal indicator, masculine
&#187;&raquo;»angle quotation mark, right
&#188;&frac14;¼fraction one-quarter
&#189;&frac12;½fraction one-half
&#190;&frac34;¾fraction three-quarters
&#191;&iquest;¿inverted question mark
&#192;&Agrave;Àcapital A, grave accent
&#193;&Aacute;Ácapital A, acute accent
&#194;&Acirc;Âcapital A, circumflex accent
&#195;&Atilde;Ãcapital A, tilde
&#196;&Auml;Äcapital A, dieresis or umlaut mark
&#197;&Aring;Åcapital A, ring
&#198;&AElig;Æcapital AE diphthong (ligature)
&#199;&Ccedil;Çcapital C, cedilla
&#200;&Egrave;Ècapital E, grave accent
&#201;&Eacute;Écapital E, acute accent
&#202;&Ecirc;Êcapital E, circumflex accent
&#203;&Euml;Ëcapital E, dieresis or umlaut mark
&#204;&Igrave;Ìcapital I, grave accent
&#205;&Iacute;Ícapital I, acute accent
&#206;&Icirc;Îcapital I, circumflex accent
&#207;&Iuml;Ïcapital I, dieresis or umlaut mark
&#208;&ETH;Ðcapital Eth, Icelandic
&#209;&Ntilde;Ñcapital N, tilde
&#210;&Ograve;Òcapital O, grave accent
&#211;&Oacute;Ócapital O, acute accent
&#212;&Ocirc;Ôcapital O, circumflex accent
&#213;&Otilde;Õcapital O, tilde
&#214;&Ouml;Öcapital O, dieresis or umlaut mark
&#215;&times;×multiply sign
&#216;&Oslash;Øcapital O, slash
&#217;&Ugrave;Ùcapital U, grave accent
&#218;&Uacute;Úcapital U, acute accent
&#219;&Ucirc;Ûcapital U, circumflex accent
&#220;&Uuml;Ücapital U, dieresis or umlaut mark
&#221;&Yacute;Ýcapital Y, acute accent
&#222;&THORN;Þcapital THORN, Icelandic
&#223;&szlig;ßsmall sharp s, German (sz ligature)
&#224;&agrave;àsmall a, grave accent
&#225;&aacute;ásmall a, acute accent
&#226;&acirc;âsmall a, circumflex accent
&#227;&atilde;ãsmall a, tilde
&#228;&auml;äsmall a, dieresis or umlaut mark
&#229;&aring;åsmall a, ring
&#230;&aelig;æsmall ae diphthong (ligature)
&#231;&ccedil;çsmall c, cedilla
&#232;&egrave;èsmall e, grave accent
&#233;&eacute;ésmall e, acute accent
&#234;&ecirc;êsmall e, circumflex accent
&#235;&euml;ësmall e, dieresis or umlaut mark
&#236;&igrave;ìsmall i, grave accent
&#237;&iacute;ísmall i, acute accent
&#238;&icirc;îsmall i, circumflex accent
&#239;&iuml;ïsmall i, dieresis or umlaut mark
&#240;&eth;ðsmall eth, Icelandic
&#241;&ntilde;ñsmall n, tilde
&#242;&ograve;òsmall o, grave accent
&#243;&oacute;ósmall o, acute accent
&#244;&ocirc;ôsmall o, circumflex accent
&#245;&otilde;õsmall o, tilde
&#246;&ouml;ösmall o, dieresis or umlaut mark
&#247;&divide;÷divide sign
&#248;&oslash;øsmall o, slash
&#249;&ugrave;ùsmall u, grave accent
&#250;&uacute;úsmall u, acute accent
&#251;&ucirc;ûsmall u, circumflex accent
&#252;&uuml;üsmall u, dieresis or umlaut mark
&#253;&yacute;ýsmall y, acute accent
&#254;&thorn;þsmall thorn, Icelandic
&#255;&yuml;ÿsmall y, dieresis or umlaut mark
 

Mathematical, Greek and Symbolic Characters

CodeEntityCharacterDescription
Latin Extended-B
&#402;&fnof;ƒlatin small f with hook (function or florin)
Greek
&#913;&Alpha;Αgreek capital letter alpha
&#914;&Beta;Βgreek capital letter beta
&#915;&Gamma;Γgreek capital letter gamma
&#916;&Delta;Δgreek capital letter delta
&#917;&Epsilon;Εgreek capital letter epsilon
&#918;&Zeta;Ζgreek capital letter zeta
&#919;&Eta;Ηgreek capital letter eta
&#920;&Theta;Θgreek capital letter theta
&#921;&Iota;Ιgreek capital letter iota
&#922;&Kappa;Κgreek capital letter kappa
&#923;&Lambda;Λgreek capital letter lambda
&#924;&Mu;Μgreek capital letter mu
&#925;&Nu;Νgreek capital letter nu
&#926;&Xi;Ξgreek capital letter xi
&#927;&Omicron;Οgreek capital letter omicron
&#928;&Pi;Πgreek capital letter pi
&#929;&Rho;&RHo;greek capital letter rho
&#931;&Sigma;Σgreek capital letter sigma
&#932;&Tau;Τgreek capital letter tau
&#933;&Upsilon;Υgreek capital letter upsilon
&#934;&Phi;Φgreek capital letter phi
&#935;&Chi;Χgreek capital letter chi
&#936;&Psi;Ψgreek capital letter psi
&#937;&Omega;Ωgreek capital letter omega
&#945;&alpha;αgreek small letter alpha
&#946;&beta;βgreek small letter beta
&#947;&gamma;γgreek small letter gamma
&#948;&delta;δgreek small letter delta
&#949;&epsilon;εgreek small letter epsilon
&#950;&zeta;ζgreek small letter zeta
&#951;&eta;ηgreek small letter eta
&#952;&theta;θgreek small letter theta
&#953;&iota;ιgreek small letter iota
&#954;&kappa;κgreek small letter kappa
&#955;&lambda;λgreek small letter lambda
&#956;&mu;μgreek small letter mu
&#957;&nu;νgreek small letter nu
&#958;&xi;ξgreek small letter xi
&#959;&omicron;οgreek small letter omicron
&#960;&pi;πgreek small letter pi
&#961;&rho;ρgreek small letter rho
&#962;&sigmaf;ςgreek small letter final sigma
&#963;&sigma;σgreek small letter sigma
&#964;&tau;τgreek small letter tau
&#965;&upsilon;υgreek small letter upsilon
&#966;&phi;φgreek small letter phi
&#967;&chi;χgreek small letter chi
&#968;&psi;ψgreek small letter psi
&#969;&omega;ωgreek small letter omega
&#977;&thetasym;ϑgreek small letter theta symbol
&#978;&upsih;ϒgreek upsilon with hook symbol
&#982;&piv;ϖgreek pi symbol
General Punctuation
&#8226;&bull;bullet (black small circle)
&#8230;&hellip;horizontal ellipsis (three dot leader)
&#8242;&prime;prime (minutes or feet)
&#8243;&Prime;double prime (seconds or inches)
&#8254;&oline;overline (spacing overscore)
&#8260;&frasl;?⁄fraction slash
Letterlike Symbols
&#8472;&weierp;script capital P (power set or Weierstrass p)
&#8465;&image;blackletter capital I (imaginary part)
&#8476;&real;blackletter capital R (real part symbol)
&#8482;&trade;trade mark sign
&#8501;&alefsym;alef symbol (first transfinite cardinal, NOT the same as hebrew letter alef)
Arrows
&#8592;&larr;leftwards arrow
&#8593;&uarr;upwards arrow
&#8594;&rarr;rightwards arrow
&#8595;&darr;downwards arrow
&#8596;&harr;left right arrow
&#8629;&crarr;downwards arrow with corner leftwards (carriage return)
&#8656;&lArr;leftwards double arrow
&#8657;&uArr;upwards double arrow
&#8658;&rArr;rightwards double arrow
&#8659;&dArr;downwards double arrow
&#8660;&hArr;left right double arrow
Mathmatical Operators
&#8704;&forall;for all
&#8706;&part;partial differential
&#8707;&exist;there exists
&#8709;&empty;empty set (null set or diameter)
&#8711;&nabla;nabla (backward difference)
&#8712;&isin;element of
&#8713;&notin;not an element of
&#8715;&ni;contains as member
&#8719;&prod;n-ary product (product sign)
&#8721;&sum;n-ary sumation
&#8722;&minus;minus sign
&#8727;&lowast;asterisk operator
&#8730;&radic;square root (radical sign)
&#8733;&prop;proportional to
&#8734;&infin;infinity
&#8736;&ang;angle
&#8743;&and;logical and (wedge)
&#8744;&or;logical or (vee)
&#8745;&cap;intersection (cap)
&#8746;&cup;union (cup)
&#8747;&int;integral
&#8756;&there4;therefore
&#8764;&sim;tilde operator (varies with, NOT the same as tilde)
&#8773;&cong;approximately equal to
&#8776;&asymp;almost equal to (asymptotic to)
&#8800;&ne;not equal to
&#8801;&equiv;identical to
&#8804;&le;less-than or equal to
&#8805;&ge;greater-than or equal to
&#8834;&sub;subset of
&#8835;&sup;superset of
&#8836;&nsub;not a subset of
&#8838;&sube;subset of or equal to
&#8839;&supe;superset of or equal to
&#8853;&oplus;circled plus (direct sum)
&#8855;&otimes;circled times (vector product)
&#8869;&perp;up tack (orthogonal to or perpendicular)
&#8901;&sdot;dot operator
Miscellaneous Technical
&#8968;&lceil;left ceiling (apl upstile)
&#8969;&rceil;right ceiling
&#8970;&lfloor;left floor (apl downstile)
&#8971;&rfloor;right floor
&#9001;&lang;left-pointing angle bracket (bra)
&#9002;&rang;right-pointing angle bracket (ket)
Geometric Shapes
&#9674;&loz;lozenge
Miscellaneous Symbols
&#9824;&spades;black spade suit
&#9827;&clubs;black club suit (shamrock)
&#9829;&hearts;black heart suit (valentine)
&#9830;&diams;black diamond suit
 

Special Characters

CodeEntityCharacterDescription
C0 Controls and Basic Latin
&#34;&quot;"quotation mark
&#38;&amp;&ampersand
&#60;&lt;<less-than sign
&#62;&gt;>greater-than sign
Latin Extended-A
&#338;&OElig;Œlatin capital ligature OE
&#339;&oelig;œlatin small ligature oe
&#352;&Scaron;Šlatin capital letter S with caron
&#353;&scaron;šlatin small letter s with caron
&#376;&Yuml;Ÿlatin capital letter Y with diaeresis
Spacing Modifier Letters
&#710;&circ;ˆmodifier letter circumflex accent
&#732;&tilde;˜small tilde
General Punctuation
&#8194;&ensp;en space
&#8195;&emsp;em space
&#8201;&thinsp;thin space
&#8204;&zwnj;?‌zero width non-joiner
&#8205;&zwj;?‍zero width joiner
&#8206;&lrm;?‎left-to-right mark
&#8207;&rlm;?‏right-to-left mark
&#8211;&ndash;en dash
&#8212;&mdash;em dash
&#8216;&lsquo;left single quotation mark
&#8217;&rsquo;right single quotation mark
&#8218;&sbquo;single low-9 quotation mark
&#8220;&ldquo;left double quotation mark
&#8221;&rdquo;right double quotation mark
&#8222;&bdquo;double low-9 quotation mark
&#8224;&dagger;dagger
&#8225;&Dagger;double dagger
&#8240;&permil;per mille sign
&#8249;&lsaquo;single left-pointing angle quotation mark
&#8250;&rsaquo;single right-pointing angle quotation mark
&#8364;&euro;euro sign
 

Notes

In order to view the following character entities, your browser must support the respective character set:

Latin-1 Characters: ISO 8859-1 (Supported by HTML 2.0 and later)

Mathematical, Greek and Symbolic Characters: ISO 10646

Special Characters: ISO 10646

Back to ASCII Art Academy

 

Useful Resources

  • ASCII Art Academy - articles and tutorials about ASCII art
  • Online Videos releated to text art, BBS, demoscene, SAC and Warez
  • ASCII Nudes Collection - 30 Years of "Naked" ASCII Art - 30 pieces of ASCII art showing nude girls created by hand by various different artists. A "boss key" feature is available too, which is interesting by itself, showing additional examples of great ASCII art without nudity.
  • "Morph" - ASCII Animation (ASCIIMation) using JavaScript created by Skylined. It "morphs" a number of ASCII pictures from one into another and finishes with a great "mandelbrot" fractal zoom.
  • "Star Field" - Another nice ASCII Animation using JavaScript created by Skylined showing a horizontal semi 3d star field animation like the ones that were popular in old computer demos and intros.