What Is an HPGL File? Plotter Instructions, Written in Plain Text
HPGL is a language, and your file holds commands written in it. Jump to your question below, or work through it in order.
HPGL is a language, and your file holds commands written in it. Jump to your question below, or work through it in order.
An HPGL file holds drawing instructions for a plotter. Hewlett-Packard named the language in 1977, and every line in your file orders the machine to lift its pen, drop it or move somewhere.
It is plain text. Open it in Notepad and you can read every instruction, which settles most of what people arrive here asking.
HPGL stands for Hewlett-Packard Graphics Language, and it was originally developed by Hewlett-Packard to drive its own pen plotters. HP began marketing its two-letter graphics language under that name in 1977, alongside the 9872A, its first multi-pen plotter. That machine cost $4,200, held four pens and capped them so they would not dry out between jobs.
The language spread far past HP. Wikipedia puts it plainly: HP-GL was introduced with the 9872 in 1977 and became a standard for almost all plotters. Plotters built between 1980 and 2000 very likely understood these commands, whoever made them.
One detail explains almost everything people find strange about these files. HPGL was never designed to sit on a disk. It was orders streaming down an interface cable to the plotter, which drew while it listened. Saving those orders came later, and the language never gained any of the things real file formats have.
HPGL is text from end to end, based on two-letter commands. No header, no index, no checksum and no magic number. HPGL files start on their first command and end when the commands run out. That is why nothing identifies it automatically, and also why there is very little in it to break.
.hpgl, .hpg, .hgl, and most often .pltIN;, meaning initializeapplication/vnd.hp-HPGL, registered with IANAx-fmt/83 and x-fmt/293.plt instead, because the program that wrote one chose the name and nothing in the language has an opinion. See section 7.Commands are two letters, then numbers, then a semicolon. PA5000,1000; orders the pen to one point. Follow enough of them in order and the drawing appears, though it is never in the file.
Think about a recipe. It lists what to do and in what order, and it contains no food. HPGL files work the same way, and the viewer does the cooking. When you open one and see text, nothing is wrong. Text is all there ever was.
Every instruction follows one shape. Two letters name the command, and HP calls those two letters its mnemonic. Numbers give it parameters, commas act as the separator between them and the semicolon is the terminator that ends it. PA means plot absolute, so PA5000,1000; sends the pen to a point 5,000 units across and 1,000 units up.
Four moves cover most of any HPGL file. PU lifts the pen, PD drops it, PA moves to fixed coordinates measured from the origin and PR moves by an offset from wherever the pen already sits. Lift, move, drop, move. Lines get drawn on the moves made with the pen down.
| Group | Command | What it orders |
|---|---|---|
| Set up | IN | Initialize. Almost always the first thing in the file |
DF | Go back to default settings | |
| Area and scale | IP | Place the scaling points P1 and P2 |
SC | Lay your own coordinate system over them | |
IW | Set a window, and clip anything outside it | |
| Pen and movement | PU | Pen up |
PD | Pen down | |
PA | Plot absolute, to a fixed point | |
PR | Plot relative, by an offset | |
| Shapes | CI | Draw circles of the radius given |
AA | Draw arcs around a center point | |
PM, FP, EP | Build a polygon, fill it, outline it | |
| Appearance | SP | Select pens by number |
LT | Set line types, dotted or dashed | |
PW | Set pen width in millimeters. HP-GL/2 only | |
PC | Set pen colors. HP-GL/2 only | |
| Text | LB | Draw labels, meaning text on the page |
SI | Set character size | |
| Finish | PG | Advance the page |
HP sorts these into five groups: Character, Vector, Polygon, Line and Fill Attribute, plus Configuration and Status. The names come from HP's own PCL guide, and they are worth knowing because viewer software often reports errors by group.
Orders. Lift the pen. Move here. Drop it. Draw circles of this radius. Select pen 3. Advance the page.
Pictures. No pixels, no preview, no thumbnail and no page size. Something has to execute the orders before anything appears.
This is the same idea behind EPS artwork files and PostScript files. Adobe's language and HP's both describe pages as programs that devices run. PostScript won the printing world and HPGL won the plotter, and the two of them spent the 1990s inside the same machines.
No operating system ships an HPGL viewer. Windows never has and macOS never has, so double-clicking one does nothing. That is the expected result, not a fault. Install a free viewer or convert the file. The file itself is almost certainly fine.
People land here after double-clicking an archived HPGL file and getting nothing back from Windows. The instinct is that something inside went bad. Almost never. Microsoft has never shipped anything that reads HPGL, so there is nothing for the double-click to hand an HPGL file to.
The older version of this page listed four reasons Windows cannot open an HPGL file. Three of them are wrong and the fourth is right for the wrong reason. They are worth walking through, because those same four sentences appear on dozens of file-help pages.
It is not a virus, not the registry and not damage. No viewer is installed, and that is the entire story.
| What you see | What it usually means | Start with |
|---|---|---|
| Double-click does nothing | Nothing on the machine reads HPGL | Free viewers, or hp2xx |
| Windows offers the Store | The extension has no association | Ignore it and install a viewer |
| It opens as readable text | Working exactly as intended | Nothing. That is HPGL |
| Drawing appears, wrong size | Scaling points were guessed | See section 9 |
| Drawing appears, half of it missing | Clip windows, or truncation | Open it in Notepad and look at the end |
| Circles come out as nothing | Your importer skips the CI command | Use hp2xx, not Inkscape |
| Blocks of random letters inside | The PE command, encoded on purpose | Nothing. See section 8 |
| Printer spits out pages of text | HPGL went to a printer that speaks PostScript | Convert to PDF instead |
That last row is in the media type registration. When HP registered application/vnd.hp-HPGL it filed a security note. That note reads: delivery of this format to a printer which is not capable of parsing the format may result in poor printer behavior. Pages of stray commands is what poor printer behavior looks like.
Two free answers cover almost everybody. Text editors tell you what is in the file. hp2xx turns it into something you can look at. Neither costs anything and neither needs a plotter.
Programs that open HPGL files split into two camps. Some show you the drawing, and some show you the commands behind it. Most guides answer this with twenty product names, half of them discontinued and most of them paid. The honest list is short.
| Software | Runs on | Why choose it |
|---|---|---|
| Any text editor | Everywhere | Start here. Notepad, TextEdit or VS Code shows you every command in an HPGL file |
| hp2xx | Windows, Mac, Linux | The workhorse. GNU software that converts HPGL into SVG, PDF, DXF, EPS, PNG and more |
| ideaMK HPGL Viewer | Windows | Opens HPGL, HP-GL/2 and PLT files and exports PNG, JPG, GIF, TIFF and BMP |
| Inkscape | Windows, Mac, Linux | Imports the line work for editing. It skips circles and arcs, so check the result |
| ImageMagick | Windows, Mac, Linux | Handles HPGL through a helper, which is useful inside a script |
Inkscape earns its warning. Its HPGL importer does not understand the CI circle command, and arcs and polygons give it the same trouble. That gap is an open issue on Inkscape's own tracker. Floor plans full of straight walls import beautifully, and schematics full of circles come in with holes.
| Software | Platform | When it earns the money |
|---|---|---|
| ViewCompanion | Windows | Batch conversion of large plot archives, with markup and measurement |
| CADSoftTools ABViewer | Windows | Viewing HPGL beside DWG and DXF from the same window |
| CorelDRAW Graphics Suite | Windows, Mac | Editing the drawing as artwork. See CDR files |
| Canvas X Pro | Windows | Technical illustration, where the plot is the starting point |
| Lemkesoft CADintosh | Mac | One of very few Mac tools that still reads plotter files |
| vhf interservice Cenon | Mac, Linux | CAM work, where the plot drives cutting machines |
One file, once? Open it in Notepad to confirm it is really HPGL, then run hp2xx to get your PDF. Nothing needs installing beyond that, and nothing needs paying for.
The software lists on the big directories have rotted. One of them was last updated in December 2012 and still recommends CorelDRAW Graphics Suite X6, Corel PaintShop Pro X5 and ACD Systems Canvas 14. Another lists SwiftView first, marked as verified, years after it was discontinued.
The older version of this page copied one of those lists and broke it. It named vhf interservice Cenon as “VHF interservice canon”, and told readers to select CorelDRAW Graphics Suite X8 or PaintShop Pro X9 from the Open with menu.
One command converts HPGL files to PDF, SVG or DXF. hp2xx -m pdf drawing.plt is the entire job, it is free and it runs on every desktop operating system.
Converting is usually the right move, because HPGL files that only three programs can read are poor places to keep drawings. Where yours should go depends on what happens next. Send someone a PDF file. Put it on a website as SVG. Hand it back to CAD software as DXF.
The -m flag selects the output mode. Change three letters and the destination changes with it. GNU describes it this way: it reads HPGL ASCII source files, interprets them and converts them into either another vector-oriented format or one of several rasterfile formats.
| You want | Convert to | Mode |
|---|---|---|
| Send it to somebody | -m pdf | |
| Put it on the web | SVG | -m svg |
| Open it in CAD software | DXF | -m dxf |
| Drop it into a document | EPS | -m eps |
| Pictures for a report | PNG | -m png |
| Archive masters | TIFF | -m tiff |
| Drive CNC machines | G-code | -m nc |
SVG and DXF keep the drawing as lines, so it stays sharp at any size and stays editable. PNG and TIFF flatten it into pixels at one fixed size. For technical drawings, choose vector destinations unless somebody specifically asked for pixels.
IN; or another two-letter command. Some files named .plt hold something else entirely.hp2xx writes one output file per page, and the -P option limits it to a page range.Online converters will do this too, and they get a copy of your drawing. For sample files that hardly matters. For your client's site plan or your production part it matters a great deal, and hp2xx runs on your own machine in less time than the upload takes.
Open the file in Notepad. You will see short commands, one after another, starting with something like IN;. Reading them settles whether the HPGL file is complete faster than any repair tool.
This is the trick nobody on the first page of results tells you to try, and it is the single most useful thing on this HPGL page. HPGL files are plain text. Right-click yours, open it with Notepad on Windows or TextEdit on macOS, then look.
Every HPGL file runs in the same three stages. Initialization sets the machine up and chooses a pen. Plot data does the drawing, and it is nearly all of the file. Termination parks the pen and ends the job.
Here is what a short one looks like, with the meaning of every line beside it. A typical HPGL file follows the same pattern, with thousands more coordinate lines in the middle.
| Line | What it orders |
|---|---|
IN; | Initialize. Clear everything and start a job |
IP; | Put the scaling points P1 and P2 back where they started |
SP1; | Select pen 1 |
PU0,0; | Lift the pen and move to the origin |
PD100,0,100,100,0,100,0,0; | Drop the pen and trace four corners, drawing a box |
PU50,50; | Lift again and move to the middle |
CI25; | Draw the circle, radius 25, around that point |
SS; | Select the standard character set |
DT*,1; | Mark the asterisk as the end of labels, and do not draw it |
PU20,80; | Lift and move to where the text should start |
LBHello World*; | Draw the words Hello World |
PU;PA0,0;SP; | Lift, go home, put the pen away. The job is over |
Scroll to the bottom. Finished HPGL files end on a complete command, terminated by a semicolon. Most park the pen with something like PU;PA0,0;SP; or advance the page with PG1;. One that stops halfway through a coordinate was cut off, and where it stops is where the transfer or the save failed.
That is as close to file repair as HPGL gets, and it is also as much as it needs. With no index and no checksum, truncated HPGL files still convert. You simply get the part of the drawing that arrived.
Ends on a semicolon. Often PU;PA0,0;SP; or PG1;. Every command in the file is complete.
Ends mid-number. Something like PD4820,31 with no semicolon and nothing after it.
One thing in Notepad will look like damage and is not. Blocks of dense random letters after the characters PE are the Polyline Encode command doing its job. HP-GL/2 packs coordinates into base 64 or base 32 so the file travels faster, and that part is genuinely not meant for human eyes. Section 8 covers it.
Your HPGL file is probably named .plt. HPGL never defined a file extension, because when it was written there was no file. Whichever program saved the plot chose the name, and they all chose differently.
People search for HPGL and then cannot find an HPGL file anywhere on the disk. The reason is that the extension came from outside. Nothing in the language names a specific one.
HP named a language in 1977 for commands traveling down an interface cable to a plotter that was drawing as they arrived. Saving those commands was somebody else's idea years later, and every program that did it made up its own name.
| Extension | Usually written by |
|---|---|
.plt | The commonly used one. AutoCAD and most CAD applications, plotting to a file |
.hpgl | Tools that name the file after the language |
.hpg | Older DOS-era software, squeezed into three characters |
.hgl | Another three-character abbreviation of the same thing |
.hp, .hp1, .hp2 | Sample sets and older plotting utilities |
.gl2 | Files that specifically hold HP-GL/2 |
.prn, .spl | Captured print jobs and spool files, which may hold anything |
This is the honest answer, and one vendor page is the only result on the first page of Google that gives it. PLT is a file name. HPGL is a language. They are not the same thing.
Most files named .plt contain HPGL, and some contain something else entirely, so open yours and look at the first line before assuming anything.
The reverse trap catches people too. A file named .prn or .spl is a captured print job, and a captured print job might hold HPGL, PostScript or raw printer data. Only the first few characters tell you which.
Landed here with a .plt file? Our PLT file format page covers the extension itself and what else can hide behind it.
This is also why no tool can identify these files reliably. The file utility on Linux and Mac names thousands of formats from their opening bytes, and it could not name HPGL until December 2022. The developer who wrote that patch put the problem in one line: the Hewlett-Packard Graphics have no unique magic pattern. Section 11 has the rest.
HP-GL/2 arrived in 1990 with pen width, color, filled polygons and a packed coordinate form. It then went into PCL 5, which is why laser printers have understood plotter commands for thirty-five years.
The original language assumed a carousel of physical pens. You selected pen 3 and pen 3 came down. Line weight meant whichever nib was in the holder, and color meant whichever ink somebody loaded that morning.
Inkjet and laser machines had no pens, so HP-GL/2 stopped pretending. PW sets a line width in millimeters. PC sets a color directly. NP sets the number of pens in the imaginary carousel. Filled polygons arrived, which a pen plotter could only ever fake by scribbling.
| HPGL | HP-GL/2 | |
|---|---|---|
| Arrived | 1977 | 1990 |
| Built for | Pen plotters | Inkjet and laser printers |
| Line width | Whichever pen is loaded | Set in millimeters with PW |
| Color | Whichever pen is loaded | Set directly with PC |
| Filled shapes | Scribbled by hand | Real polygon fill |
| Coordinates | Plain numbers | Plain numbers, or packed with PE |
| Readable in Notepad | Always | Mostly, apart from PE blocks |
| Lives inside | Its own file | PCL 5, on every HP laser printer |
PCL 5 shipped in March 1990 on the HP LaserJet III, and it brought the HPGL language with it. HP's own developer documentation says PCL 5 incorporates HP-GL/2 functionality that allows the printing of HP-GL/2 vector graphics files. In HP's manuals the chapter covering it is titled vector graphics.
A printer switches into HP-GL/2 with the escape sequence Esc%#B, draws, then switches back with Esc%#A.
That decision kept the language alive long after the last pen plotter was sold. A drawing language designed for a four-pen carousel in 1977 is still sitting in the firmware of office printers, and almost nobody using one has heard of it.
HP-GL/2 added PE, the Polyline Encoded command. HP's description is that it combines a sequence of PA, PR, PU, PD and SP commands into a coded format, which reduces file size and transmission time. Coordinates go into base 64 or base 32 and travel as ordinary characters.
The encoding is simple enough to describe and useless to read. A positive number is doubled. A negative number has its sign dropped, gets doubled and gains one. The result converts to base 64 and travels least significant digit first.
So a PE block is a wall of letters, and it is the one part of an HPGL file a person cannot read.
Everything else. Setup, pen changes, labels, circles, page commands and every plain coordinate in the file.
A PE block. Packed coordinates in base 64. Not damage, not encryption, just compression for a slow cable.
HP RTL rides in the same stream. Raster Transfer Language carries actual pixels, so a modern HPGL file can hold vector commands and a raster image together, mixed with PCL.
That mixture is why some converters handle one file perfectly and choke on the next. It is also why a few HPGL files carry no escape sequence to announce the switch.
The numbers in the file are plotter units of 0.025 mm, and the file usually carries no paper size at all. The scaling points decide how those numbers land, and different software guesses differently.
An HPGL drawing opens, everything looks right, then it prints at half the size it should. Or it fills four sheets. Or the right-hand third is missing. This is the commonest HPGL problem there is, and nothing is broken when it happens.
Every coordinate in an HPGL file is counted in plotter units. HP's own wording is that one plotter unit equals 0.025 mm or 0.00098 inches. That works out at 40 units per millimeter and 1,016 units per inch, so PA1016,0; moves the pen exactly one inch across.
| Distance | Plotter units |
|---|---|
| 1 plotter unit | 0.025 mm, or 0.00098 inch |
| 1 millimeter | 40 |
| 1 inch | 1,016 |
| An A4 sheet, long edge | About 11,880 |
| An A0 sheet, long edge | About 47,600 |
Two points called P1 and P2 mark opposite corners of an HPGL drawing area. The IP command places them and the SC command lays your own coordinate system across them, so the file can count in user units of any size you choose. Where those two points sit decides whether the same file plots small or wall-sized.
When a file gives neither, the numbers stay raw plotter units and the viewer decides. When a file sets them for a sheet you no longer have, the viewer maps them onto whatever it does have. Both roads lead to a plot that is too small or too big, and neither means the file is damaged.
Fix it in the viewer, never in the file. Every HPGL viewer has a scale or fit-to-page setting, and that is the right place to solve this. Editing coordinates in a text editor to make a drawing bigger throws away the only accurate record of what was plotted.
Missing edges usually come from IW, which sets a clip window. Anything outside it is clipped on purpose. Search the file for IW and you will find the numbers that decided what got cut.
Inside PCL the same job is done by the picture frame. HP defines it as the destination rectangle on the logical page into which the HP-GL/2 graphic is placed. Same problem, different name: something outside the drawing has to decide how big it is, because the drawing itself never says.
Pen plotters are gone and the language is not. AutoCAD still ships an HP-GL/2 driver, cutting machines take it directly and every PCL 5 printer can carry out its commands.
The HPGL language, written for a four-pen carousel in 1977, should be dead. It is not. HP made it the way printers talk about lines, and nothing since has bothered to replace that.
Nothing is coming to take these files away. The hp2xx converter will read one for as long as somebody compiles it, and the commands inside are simple enough that a new reader could be written in a weekend. The risk is not the format. The risk is that nobody in your building remembers what the drawings are.
Convert anything you need to send to another person, anything going into a modern CAD package and anything that is the only surviving copy of something built. Leave the rest where it is. An HPGL file costs almost nothing to store, and it stays the most accurate record of what was on that sheet.
Working with CAD exchange formats? IGS files and STP files move geometry between design packages, and STL files carry it to a 3D printer.
HPGL and PostScript spent the 1990s in the same machines. Adobe's language described type and shapes for printers while HP's described lines for plotters, and plenty of hardware understood both. Adobe's side of that split produced the PostScript page language and the EPS file format. HP's side produced plot files.
Registered, documented and impossible to detect. HP-GL has an official media type at IANA and a published reference book, and still no magic number, which is a combination almost nothing else manages.
Nothing here helps you open an HPGL drawing. It is on record for two reasons. HP documented this language properly, which is rare among the formats on this site. And the identification story is genuinely unusual.
| Item | Value |
|---|---|
| Media type | application/vnd.hp-HPGL, registered with IANA |
| Registered by | Hewlett-Packard, through its Customer Service Center |
| Published specification | The HP-GL/2 and HP RTL Reference Guide, Addison-Wesley |
| ISBN cited in the registration | 0-201-63325-6 |
| Transfer encoding | Binary, because lines can run very long |
| PRONOM, plotter files | x-fmt/83, Hewlett Packard Vector Graphic Plotter File |
| PRONOM, HPGL | x-fmt/293, Hewlett Packard Graphics |
| Signature | None |
That registration is worth a moment. Most of the formats covered on this site have no official media type at all, and their tools fall back on an invented one. HP filed a real registration, and it is still the correct answer when software asks what an HPGL file is.
The file utility names thousands of formats by reading their opening bytes. Until December 2022 it had nothing for the format, and reported real HPGL files as plain text or as data. A contributor fixed that, and put the reason in one sentence: the Hewlett-Packard Graphics have no unique magic pattern.
The patch guesses instead. It watches for IN; or SP or PS at the very start of a file. For HP-GL/2 it looks for the escape sequence that switches a printer into graphics mode. Real samples in that same thread open with IN;PU;SP1;PU0,0;PD0,90;, DF;IN;LT;PU1000,1000;, NP8; and PA4000,3000;. No two agree.
A registered media type, a published book and thirty-five years of software. It is better documented than most formats that came after it.
A magic number, a header or a version field. No HPGL file existed to put them in when the language was written.
The older version of this page was set to noindex. It carried noindex,nofollow in its head, the only guide on FileFix that did, which meant search engines were told to skip it for years. That is fixed here along with everything else.
Two moves settle most of what is left. Try them in order.
Open it in Notepad. Two-letter commands ending in semicolons means yes. See section 6.
Run hp2xx -m pdf on it. Free, quick and it works on every desktop system. Section 5 has the rest.
Holding a file with a different name? Our PLT file format guide covers the extension most plot files actually use.
Comparing page languages? PS files and EPS files describe a page the same way, and a drawing usually ends up in the PDF document format.
Working in a drawing program instead? the CDR file format comes from CorelDRAW and AI files come from Adobe Illustrator, and both export plotter output.
Need a picture rather than lines? PCX files and TGA files store pixels, which is the opposite of what a plot file does.
Stuck on your computer rather than your file? Our Windows fixes and macOS guides cover the system side.
New to all of this? What a file format is covers the ground underneath, and our file format guides list the rest.
Found something here that does not match your own file? Send us the first line of it and we will check it against HP's documentation.