Epson ESC printer commands

(this article is a stub, please help by contributing additional commands or taking ownership of the page and editing it.)

P2 = ESC/P2 command
P = ESC/P command
9P = 9-Pin ESC/P command

ESC = ASCII Escape Character. 27 decimal, 1B hex.

Bolded items are ASCII Text. E.g. U is the ASCII character "U", 55 decimal.
Plain numbers are decimal binary values. E.g. 5 is a single byte with a value of 5 decimal or the ASCII ENQ command.
Plain text are ASCII control code names. E.g. BEL is the ASCII bell command with a value of 7 decimal.
Italic items are parameters which may be replaced with values as indicated in the Description column. multi-byte values are always big endian: The first byte is the least significant value.

Command 		P2 P 9P	Description
BEL     		 · · ·	Beeper. Beep for 1/10 second.
BS      		 · · · 	Backspace. Move cursor left 1 character unless at left margin. Depreciated. See ESC $, ESC \, HT, DEL
HT        		 · · · 	Tab horizontally. Move cursor 1 tab right unless at right margin or no tab defined. No scoring. C-43
LF      		 · · · 	Line feed. Move cursor down line spacing distance and to left margin. Preceed with CR. Cancels SO. C-27
VT      		 · · ·	Tab vertically C-45
FF      		 · · ·	Form feed. Print buffer, eject page, move cursor to top of next page at left margin C-29
CR       		 · · ·	Carriage return Move cursor to left margin. required after each line of text or graphics. C-25
SO       		 · · ·	Select double-width printing (one line) · · · C-140
SI       		 · · ·	Select condensed printing · · · C-134
DC1       		 · · ·	Select printer · · · C-204
DC2       		 · · ·	Cancel condensed printing · · · C-138
DC3       		 · · ·	Deselect printer · · · C-206
DC4       		 · · ·	Cancel double-width printing (one line) · · · C-144
CAN       		 · · ·	Cancel line · · · C-200
ESC 1			 — — ·	End IEEE 1284.4 protocol. Used at start of print file. (that is ESC 0x01, not ESC "1")
ESC 19	m			?	m is typically 31
ESC SO  		 · · ·	Select double-width printing (one line) · · · C-142
ESC SI  		 · · ·	Select condensed printing · · · C-136
ESC EM  		 · · ·	Control paper loading/ejecting · · · C-157
ESC SP n 		 · · ·	Set intercharacter space to n/180 in LQ or n/120 in draft. 0 to 127. C-108
ESC ! n  		 · · ·	Master select n=(12cpi?/10cpi)+2*(proportional?)+4*(condensed?)+8*(bold?)+16*(dstrike?)+32*(dwidth?)+64*(italic?)+128*(underline?) C-118
ESC #   		 · · ·	Cancel MSB control set via ESC = or ESC > C-208
ESC $   		 · · ·	Set absolute horizontal print position · · · C-31
ESC %   		 · · ·	Select user-defined set · · · C-91
ESC &   		 · · ·	Define user-defined characters · · · C-84
ESC ( -   		 · · —	Select line/score C-127
ESC ( $ 4 0 nnnn		Advance n horizontal units.
ESC ( B   		 · · ·	Bar code setup and print · · · C-195
ESC ( C 2 0 mm  	 · — —	Set page length in defined unit (see: Set Unit). (page length) = (m)*(defined unit), Clears top and bottom margin.
ESC ( C 4 0 mmmm	 · — —	Set page length in defined unit (see: Set Unit). (page length) = (m)*(defined unit), Clears top and bottom margin.
ESC ( D 4 0 bb V H      	Set dot spacing. Vertical=V/b Horizontal=H/b. b is always 1440.
ESC ( G 1 0 m       	 · — —	Select graphics mode on m=1, off m=0. Most jobs are entirely graphics. C-169
ESC ( K 2 0 0 m         	Set Color/Grey. m=0 (color), 1 (grey), or 2 (color) (? difference between 0 and 2)
ESC ( R l1 l2			Send Remote command of length=l1*256+l1. Known remote commands:
  T I 8 0 YYY M D H M S 	Timestamp Information. Year=Y3*65535+Y2*256+Y1. Month=M, Day=D, Hour(24 hour format)=H, etc...
  J S 8 0 0 1 J ? ? ? 64	Job Header. J counts the number of jobs since OS restart.
  J H 
  P M
  D P
  S N
  M I 4 0 0 1 mm        	Media Information plain=0,inkjet=1,Premium=3,Postcard=5,Photo=6,GlossyFilm=7,Transparency/Envelope=9,BackLightFilm=10,etc...
  U S
  F P
  P P 3 0 ddd            	Paper Path (tray select): Rear=0 1 0, Main=0 1 1, Photo=0 1 2, Standard=0 1 255, Manual=0 2 0, CD=0 2 1, SheetGuide=0 3 0, RollFeed=0 3 1
  L D
  J E
ESC 0 0 0 0			Exit Remote command.
ESC ( S 8 0 ww ll		Set sheet Width=w and Height=h in PageUnits.
ESC ( U 5 0 P V H BB	 · — —	Set units BaseUnits = 1/B inch. PageUnit=P*(BaseUnits). VerticalUnits=V*(BaseUnits). HorizontalUnits=H*(BaseUnits) C-50 Does not change setting previously set with other commands which reference this unit.
ESC ( V         	 · — —	Set absolute vertical print position · — — C-37
ESC ( ^         	 · — —	Print data as characters · — — C-150
ESC ( c 8 0 tttt llll 	 · — —	Set page format TopMargin=t and ImageLength=l in PageUnits · — — C-11
ESC ( e 2 0 0 d     		Set DotSize=d in unknown units.
ESC ( i 1 0 m        	 · — —	Select MicroWeaveMode=m 0-Off, 1-FullOverlap, 2-FourPass, 3-FullOverLapFourPass · — — C-171
ESC ( t         	 · — —	Assign character table · — · C-73
ESC ( v 4 0 aaaa      	 · — —	Advance vertical print position a VerticalUnits· — — C-39
ESC *                 	 · · ·	Select bit image · · · C-177
ESC +                 	 · · —	Set n/360-inch line spacing · · — C-57
ESC -                 	 · · ·	Turn underline on/off · · · C-125
ESC .                 	 · — —	Print raster graphics · — — C-172
ESC . 2         	 · — —	Enter TIFF compressed mode · — — C-175
ESC /           	 — · ·	Select vertical tab channel — · · C-67
ESC 0            	 · · ·	Select 1/8-inch line spacing · · · C-51
ESC 1            	 — — ·	Select 7/72-inch line spacing — — · C-60
ESC 2            	 · · ·	Select 1/6-inch line spacing · · · C-53
ESC 3            	 · · —	Set n/180-inch line spacing · · — C-55
ESC 3            	 — — ·	Set n/216-inch line spacing — — · C-56
ESC 4            	 · · ·	Select italic font · · · C-114
ESC 5            	 · · ·	Cancel italic font · · · C-116
ESC 6            	 · · ·	Enable printing of upper control codes · · · C-151
ESC 7            	 · · ·	Enable upper control codes · · · C-153
ESC 8            	 — — ·	Disable paper-out detector — — · C-165
ESC 9            	 — — ·	Enable paper-out detector — — · C-166
ESC :            	 · · ·	Copy ROM to RAM · · · C-89
ESC <            	 · · ·	Unidirectional mode (one line) · · · C-161
ESC =            	 · · ·	Set MSB to 0 · · · C-210
ESC >            	 · · ·	Set MSB to 1 · · · C-212
ESC ?            	 · · ·	Reassign bit-image mode · · · C-181
ESC @              	 · · ·	Reset. dump buffered data, eject any partly printed page, return all settings to default. Should start each page.
ESC A              	 · · —	Set n/60-inch line spacing · · — C-58
ESC A              	 — — ·	Set n/72-inch line spacing — — · C-59
ESC B              	 · · ·	Set vertical tabs · · · C-63
ESC C              	 · · ·	Set page length in lines · · · C-13
ESC C              	 · · ·	NUL Set page length in inches · · · C-15
ESC D              	 · · ·	Set horizontal tabs · · · C-61
ESC E              	 · · ·	Select bold font · · · C-110
ESC F              	 · · ·	Cancel bold font · · · C-112
ESC G              	 · · ·	Select double-strike printing · · · C-121
ESC H              	 · · ·	Cancel double-strike printing · · · C-123
ESC I              	 — — ·	Enable printing of control codes — — · C-155
ESC J              	 · · ·	Advance print position vertically · · · C-41
ESC K              	 · · ·	Select 60-dpi graphics · · · C-183
ESC L              	 · · ·	Select 120-dpi graphics · · · C-185
ESC M              	 · · —	Select 10.5-point, 12-cpi · · — C-102
ESC M              	 — — ·	Select 12-cpi — — · C-103
ESC N              	 · · ·	Set bottom margin · · · C-17
ESC O              	 · · ·	Cancel bottom margin · · · C-19
ESC P              	 · · —	Select 10.5-point, 10-cpi · · — C-100
ESC P              	 — — ·	Select 10-cpi — — · C-101
ESC Q              	 · · ·	Set right margin · · · C-21
ESC R              	 · · ·	Select an international character set · · · C-80
ESC S              	 · · ·	Select superscript/subscript printing · · · C-129
ESC T              	 · · ·	Cancel superscript/subscript printing · · · C-131
ESC U m               	   	Set print direction Bi m=0, uni m=1
ESC W              	 · · ·	Turn double-width printing on/off · · · C-146
ESC X              	 · — —	Select font by pitch and point · — — C-97
ESC Y              	 · · ·	Select 120-dpi, double-speed graphics · · · C-187
ESC Z              	 · · ·	Select 240-dpi graphics · · · C-189
ESC \              	 · · ·	Set relative horizontal print position · · · C-33
ESC ^              	 — — ·	Select 60/120-dpi, 9-pin graphics — — · C-191
ESC a              	 — · ·	Select justification — · · C-71
ESC b              	 — · ·	Set vertical tabs in VFU channels — · · C-65
ESC c              	 · — —	Set horizontal motion index (HMI) · — — C-99
ESC e              	 — — ·	Set fixed tab increment — — · C-69
ESC f              	 — — ·	Horizontal/vertical skip — — · C-47
ESC g              	 · · —	Select 10.5-point, 15-cpi · · — C-104
ESC g              	 — — ·	Select 15-cpi — — · C-105
ESC i C F b BB RR D. 13	 — — ·	Immediate mode image data Color Format(0=raw,1=TIFFRLE,2=?) bits/pixel BytesTotal Rows Data C-215
ESC j              	 — — ·	Reverse paper feed — — · C-214
ESC k              	 · · ·	Select typeface · · · C-95
ESC l              	 · · ·	Set left margin · · · C-23
ESC m              	 — — ·	Select printing of upper control codes — — · C-156
ESC p              	 · · ·	Turn proportional mode on/off · · · C-106
ESC q              	 · · —	Select character style · · — C-133
ESC r              	 · · ·	Select printing color · · · C-193
ESC s              	 · · ·	Select low-speed mode · · C-167
ESC t              	 · · ·	Select character table · · · C-77
ESC w              	 · · ·	Turn double-height printing on/off C-148
ESC x              	 · · —	Select LQ or draft C-93
ESC x              	 — — ·	Select NLQ or draft C-94
DEL              	 · · ·	Delete last character in buffer C-202

See also: