What Is a PCX File? The Bitmap Behind Microsoft Paint
PCX is an old raster image. Jump to your question below, or work through it in order.
PCX is an old raster image. Jump to your question below, or work through it in order.
PCX files are raster images from the 1980s. ZSoft wrote them for PC Paintbrush, and Microsoft licensed that program into Windows, where its descendant still ships as Paint.
Three parts, in order: a 128-byte header, the pixel data and sometimes 768 bytes of palette stuck on the end. Nothing in it is lossy.
Free software opens one, whatever computer you have. IrfanView, XnView, GIMP and ImageMagick all read PCX. None of them costs anything.
PCX is a raster image file format. ZSoft Corporation created it as the native file format for PC Paintbrush, and raster means it stores pixels in rows and columns rather than shapes. For several years in the late 1980s PCX was how pictures travelled between DOS programs.
Every PCX has the same three sections. A 128-byte header says how wide the picture is, how deep its colors run and which program wrote it. The image data follows, packed with run-length encoding. Then 768 bytes of palette sit at the end when the image needs them.
All of it uses little endian byte order, because PCX was written for IBM PCs and never left that assumption behind.
Lossless, indexed and old. PCX files hold the exact pixels that went in, and they compress them with the simplest scheme anybody has shipped.
.pcx, with .pcc and .dcx in the familyimage/vnd.zbrush.pcx, registered 2015Wrong page? The other PC raster format of that decade is the TGA format. Game textures today arrive as DDS files, and layered edits live in Photoshop PSD files.
ZSoft made PCX for PC Paintbrush. Microsoft licensed that program into Windows 1.0 as Paint and licensed it again for Windows 3.0. Paint has been in Windows ever since.
PCX did not come out of a committee. It is an image format developed by one company, ZSoft Corporation. ZSoft, of Marietta in Georgia, shipped PC Paintbrush in 1984 and created PCX to go with it. Microsoft bundled the program with its early mouse, then bought the right to use it. Its cut-down edition became Microsoft Paint in Windows 1.0.
Microsoft licensed a fuller version again for Windows 3.0. The program in your Start menu today descends from the one ZSoft wrote, which makes PCX the native format of the ancestor of Paint.
| When | What happened |
|---|---|
| 1984 | ZSoft ships PC Paintbrush for MS-DOS, with a 16-color EGA palette |
| 1985 | PCX arrives as the native format of PC Paintbrush, which Microsoft bundled with its mouse |
| 1985 | Microsoft licenses the program into Windows 1.0 as Paint |
| 1987 | VGA brings 256 colors, and the palette moves to the end of the file |
| 1991 | Version 5 adds 24-bit color. The format stops changing here |
| Apr 2015 | A member of the public registers image/vnd.zbrush.pcx with IANA |
Stop on that last row. The media type was registered on 3 April 2015, thirty years after the format, by an individual rather than by ZSoft. The specification the registration points at is an Internet Archive link, because the original is gone.
ZSoft went the same way. The company was sold, resold and absorbed. Wikipedia now describes it as now-defunct. The reference everyone still cites is the ZSoft PCX File Format Technical Reference Manual, written by Dean Ansley in 1991.
The Library of Congress is blunt about the documentation. Its format record says PCX “has never been completely documented”. Several specifications circulate and they disagree on details. PC Paintbrush itself reportedly read the same file differently depending on its version.
Four free programs open PCX files on any system. Windows Photos is not one of them, which is why this question looks harder than it is.
Search results for this question are walls of paid trials, and the page this one replaces listed six of them without naming a single free option. Every program below is free and reads PCX today.
| Software | Runs on | Why choose it |
|---|---|---|
| IrfanView | Windows | Fastest way to look at one. Opens PCX and converts a folder in batch |
| XnView MP | Windows, Mac, Linux | Browser and converter, with a thumbnail view that reads PCX folders |
| GIMP | Windows, Mac, Linux | Opens and saves PCX. The free editor when you need to change the picture |
| ImageMagick | Windows, Mac, Linux | One command converts a folder. Writes PCX compressed or not |
| FFmpeg | Windows, Mac, Linux | Decodes and encodes it, useful inside a script |
| Netpbm | Mac, Linux | Carries pcxtoppm and ppmtopcx for pipelines |
| Adobe Photoshop | Windows, Mac | Paid, and it reads PCX if you already own it |
Paid programs read it too. Corel PaintShop Pro and ACDSee both open PCX, and so does Adobe Photoshop if you already own it. None of them does anything the four free ones cannot.
IrfanView deserves its own line on Windows. It opens in under a second and shows the color depth and dimensions in the title bar. Its batch dialog turns folders of PCX files into PNG without a command line.
Install IrfanView. Free, tiny and it opens PCX at once.
Use ImageMagick. One line turns every PCX into PNG.
Windows Photos does not open PCX. Neither does Preview on macOS. That is the entire reason this search exists, and the fix is a free download rather than a paid converter.
Trouble with the computer rather than the PCX? Our Windows error guides and macOS fixes cover the file association problems behind most double-click failures.
PCX files that will not open are almost never damaged. Your viewer has no PCX decoder, or the file was written in one of the odd depths most software skipped.
PCX was designed around the display hardware of the 1980s, and it grew one variety per hardware mode. Most programs read the four common combinations and skip the rest.
Notice that three of those four are about the program rather than the file. Nothing in a 1990 PCX has rotted.
Online converters want your files. Four free programs do the job on your own computer, and PCX files from games folders or scanners are somebody's work. Install IrfanView or run ImageMagick rather than uploading it.
Three sections, always in the same order. A 128-byte header, the pixel data and sometimes 769 bytes of marker and palette on the end.
Open any PCX in a hex editor and the first byte is 0A. That is the signature, and it has been the signature since 1985. The second byte is the version number, and it is literally a PC Paintbrush release number. Byte 3 sets the bit depth, which PCX counts per plane rather than per pixel.
| Offset | Size | What it holds |
|---|---|---|
0 | 1 byte | Signature. Contains an identifier, always 0A hex |
1 | 1 byte | Version. 0, 2, 3, 4 or 5, naming the Paintbrush release |
2 | 1 byte | Encoding. 1 for run-length encoding, 0 for none |
3 | 1 byte | Bits per pixel, per plane. Usually 1, 2, 4 or 8 |
4 to 11 | 8 bytes | Window: the minimum and maximum x and y coordinates |
12 to 15 | 4 bytes | Horizontal and vertical resolution, and these are unreliable |
16 | 48 bytes | The 16-color EGA palette, as 16 RGB triples |
64 | 1 byte | Reserved. Always 0 |
65 | 1 byte | Number of color planes. Usually 1, 3 or 4 |
66 | 2 bytes | Bytes per scan line, per plane. Always even |
68 | 2 bytes | Palette type. 1 color, 2 grayscale |
70 | 4 bytes | Screen size of the machine that wrote the file |
74 | 54 bytes | Reserved, and still empty forty years later |
The width of the picture is not stored directly. You work it out from the window: the maximum x minus the minimum x, plus one. The same for the height. That is the kind of decision formats make when they describe screens rather than files.
Two more fields decide how the pixels come back out. Offset 65 holds the number of color planes and offset 66 holds the bytes per scan line.
A decoder needs both before it can walk one row of PCX image data. That is why a file written for an unusual plane count opens as noise in software that assumed the common case.
Two fields are worth distrusting. The resolution pair at offset 12 may hold the dots per inch, the pixel size of the target screen mode or the pixel size of the image. It may also hold one stale copy of those, and Archive Team catalogs all four.
The 54 reserved bytes at offset 74 are the second. They were kept for extensions that never came, and they are still empty.
The version byte is history you can read. Version 0 means PC Paintbrush 2.5 with its fixed EGA palette. Version 3 means 2.8 with no palette at all. Version 5 means 3.0, which is the one that learned 24-bit color. The file tells you which program made it.
Run-length encoding is lossless and it is not always smaller. A quarter of every palette costs double, so a photograph saved as PCX can finish larger than the raw bitmap.
A directory ranking for this term says PCX files “are smaller in size as they are compressed using the RLE encoding”. That is true of flat graphics and false of everything else, and the reason sits in two bits.
Run-length encoding replaces a run of identical bytes with a count and a value. PCX marks the count by setting the top two bits of a byte, which leaves six bits for the length, so a single run reaches 63 pixels. Any byte without both of those bits set is one pixel, written as itself.
Here is the catch. A pixel value from 192 to 255 already has its top two bits set, so it cannot be written on its own. It has to go out as a two-byte pair, a count of one and then the value, even when it appears once. A quarter of every palette costs double.
PCX shrinks it well. Logos, screenshots and clip art are long runs of one color.
PCX can grow it. No runs to find, and the 192 penalty still applies.
There is one fix nobody uses any more, and it is a nice piece of 1980s craft. Sort the palette so the commonest colors sit in positions 0 to 191 and the rare ones go in the top quarter. The picture is identical and the file is smaller, because the bytes you write most often are the cheap ones.
Lossless is the word that matters here. PCX never throws a pixel away. It simply stopped being good at making files small, which is what GIF and then PNG arrived to do.
Do not read large PCX files as damaged ones. 2 MB from a 1.8 MB bitmap is the format working exactly as designed. Convert it to a PDF file for sharing or to PNG for keeping, and the same pixels take far less space.
PNG beats PCX at everything it was for, and has since 1996. The only reason to keep PCX is that it is the file you were given.
All four store a grid of pixels and all four are lossless. What separates them is how hard they compress and how many programs will open one without being asked twice. Directories call PCX the main imaging format on the PC before BMP, JPEG and PNG arrived.
PCX lost on two counts, in order. GIF compressed harder in 1987, then PNG compressed harder still in 1996 and added transparency on top.
Underneath both, Archive Team names the deeper problem. PCX was built around the graphics modes of one particular machine, and the formats that beat it did not care what hardware you owned. It lost ground to newer image formats and never got it back.
| PCX | BMP | GIF | PNG | |
|---|---|---|---|---|
| Arrived | 1985 | 1985 | 1987 | 1996 |
| Lossless | Yes | Yes | Yes | Yes |
| Compression | Run-length | Usually none | LZW | Deflate, far better |
| Colors | 2 to 256, or 24-bit | Up to 24-bit | 256 maximum | Up to 48-bit |
| Transparency | Not in the spec | Rarely | One color | Full alpha |
| Opens in a browser | No | Mostly | Yes | Yes |
| Opens in Windows Photos | No | Yes | Yes | Yes |
Row three is the one that matters. Deflate, which PNG uses, finds patterns run-length encoding cannot see, so the same screenshot lands far smaller with the same pixels. Row seven is the practical one: PCX is the one image format here your operating system will not display.
Row five costs you more often than people expect. Transparency never made it into the PCX specification, so logos saved in it arrive with solid backgrounds and no way to lift them off.
Keep it and convert a copy. Nothing is lost either way.
Save PNG. Lossless, smaller and it opens everywhere.
Deciding between image formats? TGA image files came out of the same era and went the same way. EPS files hold vector artwork rather than pixels, and Nikon NEF files hold sensor data that is not a picture yet.
Convert PCX to PNG. Both are lossless, so nothing is thrown away. PNG is smaller and it opens in everything. Keep the original anyway.
Because PCX is lossless, converting one to another lossless format costs nothing at all. PNG is the right target almost every time. Choose JPEG only when the picture is a photograph and you want it small.
Lossless to lossless. Same pixels, smaller file, opens anywhere.
Lossy, one way. Fine for photographs, wrong for screenshots and line art.
That line reads every PCX in the current folder, writes a PNG for every one of them into a folder named png and leaves the sources alone. On a few hundred files it finishes before you have changed window.
ImageMagick will also tell you what a file is without converting anything. That settles most arguments about a mystery image in a second: the version, the dimensions, the color depth and the compression.
ImageMagick will write an uncompressed PCX if you ask it to. Wikipedia says there are no uncompressed PCX files and the specification agrees, yet modern software writes them with the encoding byte set to 0. Archive Team documents the gap. If a decoder refuses your file, that byte is worth checking.
Sixteen colors live in the header and 256 live at the end of the file. That split is hardware history, frozen into a format.
The PCX header has 48 bytes for a palette, which is 16 colors at three bytes apiece. That was exactly enough for EGA, the display standard PC Paintbrush was written for.
Then VGA arrived with 256 colors, needing 768 bytes. The header was frozen, and even the 54 reserved bytes after it came nowhere near. So ZSoft left the header alone and put the new palette at the very end of the file, behind a marker byte of 12.
| Image | Palette | Where it sits |
|---|---|---|
| Monochrome | None needed | Black and white, 1 bit per pixel |
| 16 colors | 48 bytes | In the header, at offset 16 |
| 256 colors | 768 bytes | The last 768 bytes, behind a byte of 12 |
| Grayscale | 768 bytes | Same place, with the palette type field set to 2 |
| 24-bit color | None needed | Three planes of 8 bits, one for red, green and blue |
Palette entries are always 8 bits per channel, whatever depth the picture uses. A 16-color file stores full-strength RGB triples in a header built for EGA, which is why those old files still show the colors somebody chose.
The practical consequence is worth knowing. 256-color PCX files truncated by bad copies or half-finished downloads keep most of their picture and lose every color. What they lost was the end of the file.
Multiple planes are stored by plane within a row, not image by image. In a 24-bit PCX the reader takes all the red for row 0, then all the green, then all the blue. Only then does it move to row 1. Software written for the wrong assumption produces the red-green-blue banding people sometimes see.
A DCX file is several PCX pages in one container. Fax and scanning software still writes them, and that is one of two corners where the format survived.
PCX holds one picture and a fax holds several pages, so ZSoft wrapped the format. Wikipedia puts the structure in one line: “A DCX file consists of a header introducing a set of following PCX files.” Nothing about the pictures changes. Only the wrapper is new.
The National Archives files that wrapper separately, as PRONOM x-fmt/348. The same software that opens PCX files will usually open DCX files and step through their pages.
| PCX | DCX | |
|---|---|---|
| Extension | .pcx, also .pcc | .dcx |
| Pages | One | Many, in order |
| Structure | Header, pixels, palette | A header, then a set of complete PCX files |
| Written by | Paint programs and scanners | Fax and document management software |
| PRONOM record | fmt/86 to fmt/90 | x-fmt/348 |
| Opens in | IrfanView, GIMP, ImageMagick | IrfanView and ImageMagick, page by page |
FileInfo says PCX is “still used by some fax and scanning applications”, and that line explains most DCX files anybody meets. DCX was used to create digital fax files, and that is still where most of them live. A scanned contract from 1998 is a stack of black and white pages, which is the one job run-length encoding does brilliantly.
A DCX converts the same way a PCX does. ImageMagick writes one PNG per page and numbers them for you, so a 40-page fax becomes 40 files in one command. Section 8 has the line.
Keep the PCX files you have, because they are lossless and free software opens them. Do not save anything new as PCX. PNG does the same job better in every direction.
For keeping, PCX is fine. A file written in 1991 opens today in four free programs, holds the exact pixels somebody drew and takes up less room than a photograph from a phone. Converting it is optional.
For saving, PCX loses on every count. PNG compresses far harder, carries transparency, reaches deeper color and opens in your browser. The only argument left for writing one is a program from 1993 that reads nothing else.
Leave it alone. Lossless, small and readable. Add a PNG copy if you want one.
Save PNG instead. Smaller, lossless and it opens in everything you own.
There is one honest exception. Modding an old game means writing the format that game reads, and for a great many DOS-era titles that format is PCX. GIMP and ImageMagick both save it.
Everything on this page in one block: names, bytes, offsets, color depths, registry records and where every fact came from.
Directories file this one under the Paintbrush Bitmap Image File type, which is the long way of naming the PCX file format. The PCX file extension your file manager shows has meant the same thing since 1985: a grid of pixels, packed by the simplest compression anybody shipped.
| Item | Value |
|---|---|
| Extension | .pcx, with .pcc and .dcx in the family |
| Stands for | PiCture eXchange by convention, and ZSoft never confirmed it |
| Kind | Raster image. Palette indexed, grayscale or 24-bit |
| Developed by | ZSoft Corporation, Marietta, Georgia, now defunct |
| Written for | PC Paintbrush, which shipped in 1984 |
| Format dated | 1985, last updated 1991 at version 5 |
| File signature | Byte 0 is 0A hex, decimal 10 |
| Header | 128 bytes, eighteen fields, little endian |
| Version byte | 0, 2, 3, 4 or 5, naming a PC Paintbrush release |
| Compression | Run-length encoding, lossless |
| Run flag | Top two bits set. Low six bits hold a count of 1 to 63 |
| Color depth | 1, 2, 4 or 8 bits per plane, up to 24-bit in version 5 |
| Palette | 48 bytes at offset 16, or 768 bytes at the end behind a byte of 12 |
| Transparency | None. It is not in the specification |
| Media type | image/vnd.zbrush.pcx, registered 3 April 2015. image/x-pcx deprecated |
| Format registry | PRONOM fmt/86 to fmt/90, and x-fmt/348 for DCX |
| Multi-page version | DCX, a header plus a set of PCX files |
| Reference manual | ZSoft PCX File Format Technical Reference Manual, Dean Ansley, 1991 |
| Free software | IrfanView, XnView MP, GIMP, ImageMagick, FFmpeg, Netpbm |
Readable without permission, and standardized by nobody. No standards body ever took it on, ZSoft is gone and the Library of Congress record states flatly that PCX was never completely documented.
What survived is a reference manual from 1991 and plenty of working code. Archive Team warns that the circulating specifications disagree about details, and that PC Paintbrush itself read the same file differently depending on its version. Nobody is even certain what the three letters abbreviate: “It's not clear what PCX stands for, if anything.”
In practice none of that matters to you. Six free programs decode it correctly, and the format stopped moving thirty-five years ago.
The header offsets, the run flag and the palette move all come from the Wikipedia article and from the Archive Team entry, which track the 1991 reference manual between them. Archive Team supplied the warnings about the resolution fields and about encoding 0.
The media type, its registration date and the games note come from the IANA record. The registry numbers come from PRONOM. The sentence about documentation comes from the Library of Congress format record. The Microsoft Paint history comes from Wikipedia's PC Paintbrush article.
Install IrfanView. Free, and it reads PCX at once. See section 3.
Your file lost its tail. Section 9 explains why.
Comparing old raster formats? The Truevision TGA format solved the same problem in the same decade, and the DDS texture format is what game artwork became.
Working on artwork rather than a bitmap? The PSD file format keeps a layered edit, the EPS format carries vector drawings and the PDF format is where finished pages end up.
Chasing a camera file instead? The Nikon NEF format and Canon CR2 files hold sensor data rather than pixels, and neither one is a picture yet.
Stuck on your computer rather than your image? Our Windows fixes and our macOS guides cover file associations and the double-click failures behind them.
New to all of this? What a file format is covers the ground underneath, and our file format guides list the rest.
Got a PCX that behaves in ways nothing here explains? Send us what ImageMagick reports and we will tell you what wrote it.