Toolman 100% local

File formats

What the extension means, what opens it, and the thing about it that actually catches people out.

Image

ExtensionFormat
.heicHigh Efficiency Image Container
.webpWebP Image
.avifAV1 Image File Format
.svgScalable Vector Graphics
.psdPhotoshop Document
.aiAdobe Illustrator Artwork
.rawCamera Raw Image

Document

ExtensionFormat
.pdfPortable Document Format
.docxWord Document
.epubElectronic Publication

Data

ExtensionFormat
.csvComma-Separated Values
.jsonJavaScript Object Notation
.yamlYAML Ain't Markup Language
.sqlSQL Script
.parquetApache Parquet

Archive

ExtensionFormat
.zipZIP Archive
.7z7-Zip Archive
.tarTape Archive
.isoDisc Image

Video

ExtensionFormat
.mp4MPEG-4 Video
.movQuickTime Movie
.mkvMatroska Video
.webmWebM Video

Audio

ExtensionFormat
.mp3MPEG Audio Layer III
.flacFree Lossless Audio Codec
.wavWaveform Audio

Font

ExtensionFormat
.ttfTrueType Font
.woff2Web Open Font Format 2

Executable

ExtensionFormat
.exeWindows Executable
.dmgApple Disk Image
.apkAndroid Package

Text

ExtensionFormat
.logLog File
.envEnvironment File

The extension is a hint, not a fact

A file's extension is just the end of its name — renaming photo.png to photo.jpg changes nothing about the bytes inside. What programs actually rely on is the magic number, the first few bytes of the file: %PDF for a PDF, PK for anything ZIP-based, \x89PNG for a PNG. On Unix, file somefile reports what a file really is regardless of its name.

Formats that are secretly ZIP files

DOCX, XLSX, PPTX, EPUB, JAR, APK and IPA are all ZIP archives with a mandated internal layout. Rename any of them to .zip, extract it, and you can read the XML or class files inside — genuinely useful when a document will not open and you need to recover the text.

Identifying a file by its first bytes

If an extension is missing or wrong, the signature at the start of the file is what actually settles the question. These are the ones worth recognising on sight:

First bytesAs textFormat
89 50 4E 47.PNGPNG
FF D8 FF—JPEG
47 49 46 38GIF8GIF
25 50 44 46%PDFPDF
50 4B 03 04PK..ZIP, and everything built on it
52 61 72 21Rar!RAR
1F 8B—gzip
52 49 46 46RIFFWAV or AVI — the next four bytes say which
00 00 00 .. 66 74 79 70....ftypMP4, MOV, HEIC and relatives
7F 45 4C 46.ELFLinux executable
4D 5AMZWindows executable — the initials of a DOS engineer

On macOS or Linux, file something reads these for you. On Windows, certutil -dump or any hex editor will show the first line. A file whose signature does not match its extension is either misnamed or deliberately disguised, and the second case is worth taking seriously in an email attachment.

Choosing an image format

Most "which format should I use" questions come down to three properties: whether the compression throws information away, whether transparency is supported, and whether animation is.

FormatCompressionTransparencyUse it for
JPEGLossyNoPhotographs, where a little quality loss is invisible and the saving is large
PNGLosslessYesScreenshots, logos, anything with sharp edges or flat colour
WebPEitherYesThe web, where it beats both of the above by roughly 25–30% at the same quality
SVGNot applicableYesIcons and diagrams — it is text describing shapes, so it scales to any size
GIFLossless, 256 colours1-bit onlyAlmost nothing any more; a short video file is smaller and looks better
AVIFLossy or losslessYesSmaller than WebP again, with support now broad enough to use with a fallback

The mistake that costs the most is saving a screenshot as JPEG. Lossy compression works by discarding detail the eye is unlikely to miss in a photograph, and it is exactly wrong for text and sharp edges — you get visible smudging around every letter and a larger file than PNG would have produced. The reverse mistake, a photograph saved as PNG, is merely wasteful rather than ugly.

Converting between them never recovers what was lost. A JPEG re-saved as PNG keeps every compression artefact and simply stops adding new ones; the damage is already in the pixels.

Why the same content has several extensions

Some pairs are genuinely the same format under different names, and some only look that way. .jpg and .jpeg are identical — the three-letter version exists because early Windows filesystems allowed no more. .htm and .html are the same for the same reason. .tif and .tiff likewise.

Others are traps. .doc and .docx are completely different formats: the first is a binary format from the 1990s, the second a ZIP of XML introduced in 2007. .xls and .xlsx differ the same way. Renaming one to the other produces a file that nothing can open, which is the single most common cause of "the file is corrupted" when someone has tried to fix a compatibility problem by editing the name.

Text files and the invisible differences

A plain text file has no header, so nothing inside it declares its encoding or line endings. Two files that look identical can differ in both, and both differences cause real problems.

Encoding is usually UTF-8 now, but files produced by older Windows software may be in a regional codepage, which is why text sometimes arrives with é where é should be — that is UTF-8 bytes being read as Latin-1. A byte-order mark at the start (EF BB BF) marks a file as UTF-8 explicitly, and is helpful to Windows and an annoyance to Unix tools, which will treat it as content.

Line endings are a single newline on Unix and macOS, and a carriage return plus newline on Windows. Git normally hides this from you, and a diff showing every line as changed is the usual sign that it has not.