ANSI Escape Codes

code mnemonic description example
ESC[0m reset Sample
ESC[1m bold Sample
ESC[2m dim Sample
ESC[3m italic Sample
ESC[4m underline Sample
ESC[5m slow blink Sample
ESC[6m rapid blink Sample
ESC[7m reverse video Sample
ESC[8m conceal Sample
ESC[9m strike-through Sample
ESC[21m double underline Sample
ESC[22m normal (not bold) Sample
ESC[23m not italic Sample
ESC[24m not underlined Sample
ESC[25m not blinking Sample
ESC[27m not reversed Sample
ESC[28m reveal Sample
ESC[29m not strike-through Sample
ESC[30m black foreground Sample
ESC[31m red foreground Sample
ESC[32m green foreground Sample
ESC[33m yellow foreground Sample
ESC[34m blue foreground Sample
ESC[35m magenta foreground Sample
ESC[36m cyan foreground Sample
ESC[37m white foreground Sample
ESC[38m foreground color (extended) Sample
ESC[39m default foreground color Sample
ESC[40m black background      
ESC[41m red background      
ESC[42m green background      
ESC[43m yellow background      
ESC[44m blue background      
ESC[45m magenta background      
ESC[46m cyan background      
ESC[47m white background      
ESC[48m background color (extended)
ESC[49m default background color
ESC[52m framed Sample
ESC[53m overline Sample
ESC[90m bright black foreground Sample
ESC[91m bright red foreground Sample
ESC[92m bright green foreground Sample
ESC[93m bright yellow foreground Sample
ESC[94m bright blue foreground Sample
ESC[95m bright magenta foreground Sample
ESC[96m bright cyan foreground Sample
ESC[97m bright white foreground Sample
ESC[100m bright black background      
ESC[101m bright red background      
ESC[102m bright green background      
ESC[103m bright yellow background      
ESC[104m bright blue background      
ESC[105m bright magenta background      
ESC[106m bright cyan background      
ESC[107m bright white background      
ESC[nA CUU cursor up (by n lines/columns) N/A
ESC[nB CUD cursor down (by n lines/columns) N/A
ESC[nC CUF cursor forward (by n lines/columns) N/A
ESC[nD CUB cursor back (by n lines/columns) N/A
ESC[nE CNL cursor next line (by n lines/columns) N/A
ESC[nF CPL cursor previous line (by n lines/columns) N/A
ESC[nG CHA cursor character absolute (by n lines/columns) N/A
ESC[n;mH CUP cursor position (to row n, column m) N/A
ESC[0J ED erase in display: erase from cursor to end of screen N/A
ESC[1J ED erase in display: erase from cursor to beginning of screen N/A
ESC[2J ED erase in display: erase entire screen N/A
ESC[3J ED erase in display: erase entire screen and clear scrollback buffer N/A
ESC[0K EL erase in line: erase from cursor to end of line N/A
ESC[1K EL erase in line: erase from cursor to beginning of line N/A
ESC[2K EL erase in line: erase entire line N/A
ESC[nS SU scroll up (by n lines/columns) N/A
ESC[nT SD scroll down (by n lines/columns) N/A
ESCc RIS reset to initial state N/A
ESC[n;mf HVP horizontal vertical position (to row n, column m) N/A
ESC[h SM mode N/A
ESC[l RM remode N/A
ESC[m SGR select graphic rendition N/A
ESC[n DSR device status report N/A
ESC[s SCP save cursor position N/A
ESC[u RCP restore cursor position N/A
ESC[?1h DECCKM enable cursor keys (application mode) N/A
ESC[?1l DECCKM disable cursor keys (application mode) N/A
ESC[?3h DECCOLM enable 132 column mode N/A
ESC[?3l DECCOLM disable 132 column mode N/A
ESC[?5h DECSCNM enable reverse video mode N/A
ESC[?5l DECSCNM disable reverse video mode N/A
ESC[?6h DECOM enable origin mode N/A
ESC[?6l DECOM disable origin mode N/A
ESC[?7h DECAWM enable auto-wrap mode N/A
ESC[?7l DECAWM disable auto-wrap mode N/A
ESC[?8h DECARM enable auto-wrap mode N/A
ESC[?8l DECARM disable auto-wrap mode N/A
ESC[?9h DECSET enable X10 mouse reporting N/A
ESC[?9l DECRST disable X10 mouse reporting N/A
ESC[?12h DECSET enable start blinking cursor N/A
ESC[?12l DECRST disable start blinking cursor N/A
ESC[?25h DECTECM enable show text cursor N/A
ESC[?25l DECTECM disable show text cursor N/A
ESC[?47h DECSET enable use alternate screen buffer N/A
ESC[?47l DECRST disable use alternate screen buffer N/A
ESC[?1000h DECSET enable VT200 mouse reporting N/A
ESC[?1000l DECRST disable VT200 mouse reporting N/A
ESC[?1002h DECSET enable button-event mouse reporting N/A
ESC[?1002l DECRST disable button-event mouse reporting N/A
ESC[?1003h DECSET enable any-event mouse reporting N/A
ESC[?1003l DECRST disable any-event mouse reporting N/A
ESC[?1004h DECSET enable send focus in/out events N/A
ESC[?1004l DECRST disable send focus in/out events N/A
ESC[?1049h DECSET enable alternate screen buffer with cursor save/restore N/A
ESC[?1049l DECRST disable alternate screen buffer with cursor save/restore N/A
ESC[?2004h DECSET enable bracketed paste mode N/A
ESC[?2004l DECRST disable bracketed paste mode N/A
ESC]8;PARAMS;URL\u0007 OSC 8 hyperlink text
ESC]8;;\u0007 OSC 8 hyperlink (end) N/A