File formats
Practical information about file formats: what a format is used for, how it’s structured, where the official specification is, which programs open and edit it, and which open-source libraries read and write it in C/C++, C#, Java, Go, Python, Ruby, Rust and PHP, with code examples.
Images#
PNGPNG is a lossless raster image format with alpha transparency. File structure (signature, chunks, IHDR, IDAT), W3C specification, software, libraries.
JPEGJPEG is the lossy image format for photos. File structure (SOI, APPn, DQT, SOF, DHT, SOS markers), JFIF and Exif, progressive and chroma subsampling.
GIFGIF is a palette-based image format with LZW compression, best known for short looping animations. File structure, specification, software and libraries.
WebPWebP is Google's lossy and lossless image format with transparency and animation. RIFF file structure (VP8, VP8L, VP8X chunks), RFC 9649, libraries.
AVIFAVIF stores AV1-compressed images in a HEIF container: small lossy and lossless files, alpha, HDR and animation. File structure, spec, software and libraries.
JPEG XLJPEG XL is a royalty-free image format with lossy, lossless and lossless JPEG recompression. File structure, specification, software and libraries.
HEICHEIC is the HEVC-coded HEIF image format used by iPhone photos. File structure (ftyp, meta, iinf, iloc), patents, how to open HEIC on Windows, libraries.
TIFFTIFF is a flexible raster image format for scans, print, archives, GIS and science. File structure (IFDs, tags, strips, tiles), BigTIFF, GeoTIFF, libraries.
BMPBMP is the uncompressed Windows bitmap image format. File structure (file header, DIB header, palette, bottom-up rows), compression, software, libraries.
ICOICO is the Windows icon format: one file holds the same icon in several sizes, stored as BMP or PNG. ICONDIR header, CUR cursors, favicon.ico and libraries.
TGATGA (Targa) is a raster image format with alpha, used for game textures and render output. File structure (header, RLE, footer), spec, software, libraries.
JPEG 2000JPEG 2000 is a wavelet-based image format for lossy and lossless compression, used in PDF, digital cinema and DICOM. File structure, software, libraries.
JPEG XRJPEG XR (.jxr, .hdp, .wdp) is Microsoft's image format for lossy and lossless HDR images, used for Windows HDR screenshots. File structure, specs, software.
SVGSVG is an XML-based vector image format for icons, logos, diagrams and web graphics. File structure, path syntax, SVGZ, security, W3C specifications.
Documents#
PDFPDF is the standard format for fixed-layout documents. File structure (objects, xref, page tree, content streams, fonts), ISO 32000-2, software, libraries.
XPSXPS and OpenXPS (.xps, .oxps) are Microsoft's fixed-layout document formats: a ZIP of XAML pages, fonts and images. File structure, viewers, libraries.
OFDOFD is China's national fixed-layout document format (GB/T 33190), a ZIP of XML files used for e-invoices. File structure, software and libraries.
DjVuDjVu is a compressed format for scanned books and documents. File structure (AT&T FORM:DJVU, INFO, Sjbz, BG44, TXTz chunks), specification, software.
PostScriptPostScript (.ps) is a page description language for printers. File structure, DSC comments, magic bytes, specifications, software and libraries.
EPSEPS is a single-page PostScript graphic with a bounding box, used to place vector art in other documents. File structure, DSC comments, binary preview header.
DVIDVI is the page format written by TeX and LaTeX: glyph and rule positions without embedded fonts. File structure, opcodes, converters, viewers, libraries.
CAJCAJ is CNKI's proprietary format for Chinese academic papers and theses, with KDH, NH and HN variants. File structure, software to convert CAJ to PDF.
eBooks#
EPUBEPUB is the open standard e-book format: a ZIP of XHTML, CSS and images with an OPF package file. File structure, W3C EPUB 3.3 specification, readers.
MOBIMOBI is the Mobipocket e-book format used by Amazon Kindle, including AZW and AZW3 (KF8). File structure (PalmDB, MOBI header, EXTH), DRM, libraries.
FB2FB2 (FictionBook 2) is an XML e-book format with embedded images, popular in Russia and Eastern Europe. File structure, XML schema, readers, libraries.
LITLIT is the discontinued Microsoft Reader eBook format: an LZX-compressed ITOLITLS container with OEB HTML. File structure, DRM, software and libraries.
PDBPDB is the Palm OS database file used for PalmDOC and eReader eBooks. Header and record layout, PalmDOC LZ77 compression, software and libraries.
CHMCHM is Microsoft's Compiled HTML Help format: HTML pages compressed with LZX in one file. File structure, how to view, extract and convert CHM.
TXTPlain text files: character encodings (UTF-8, UTF-16, Windows-1252), byte order marks, line endings, encoding detection, software and libraries.
MarkdownMarkdown is a plain text format with lightweight markup for headings, lists, links and code. CommonMark and GitHub Flavored Markdown, syntax, libraries.
RTFRTF is Microsoft's plain text format for formatted documents: control words, font and color tables, Unicode escapes. Specification, software, libraries.
Comic books and archives#
CBZCBZ is a comic book file: a ZIP archive of page images sorted by file name. File structure, ComicInfo.xml metadata, page order, software and libraries.
CBRCBR is a comic book file: a RAR archive of page images sorted by name. RAR4 vs RAR5, ComicInfo.xml, converting CBR to CBZ, software and libraries.
CB7CB7 is a comic book file: a 7z archive of page images sorted by name. Structure, solid compression and page access, ComicInfo.xml, software and libraries.
CBTCBT is a comic book file: an uncompressed TAR archive of page images sorted by name. Page order, ComicInfo.xml, creating CBT files, software and libraries.
ZIPZIP archive file structure (local headers, central directory, ZIP64), the PKWARE APPNOTE spec, software that opens ZIP files and libraries for 8 languages.
RARRAR is a proprietary compressed archive format made by WinRAR. RAR4 vs RAR5 file structure, volumes, encryption, software that opens RAR files.
7z7z is the 7-Zip archive format with LZMA2 compression, solid blocks and AES-256 encryption. File structure, specification, software and libraries.
TARTAR bundles files into one archive, often compressed as .tar.gz, .tar.xz or .tar.zst. File structure (ustar, pax, GNU), POSIX spec, software and libraries.