The letters after the dot in a file name, such as .jpg, .mp3 or .pdf, are called the extension. They hint at the file's format, which is the agreed way its data is organised. When a file will not open, or an upload is rejected, the format is almost always the reason. This handbook explains how formats work and gives you a map of the common ones.
Extension, container and codec
The extension is only a label. Renaming photo.png to photo.jpg does not change the file's contents; it just misleads programs. The real format is stored inside the file, usually in the first few bytes (the "magic number"). Reputable upload systems check this, which is why renamed files are rejected.
For audio and video there are two layers. The container (MP4, MKV, WebM, MOV, M4A) is the box that holds streams and information such as subtitles and chapters. The codec (H.264, H.265, VP9, AAC, MP3, Opus) is the method used to compress each stream. A player needs to support both. That explains why one .mp4 plays on your TV and another does not: the container is the same, the codec is different.
Images
- JPG / JPEG: lossy photographs, universal support.
- PNG: lossless, transparency, ideal for screenshots and logos.
- GIF: 256 colours, simple animations.
- WebP and AVIF: modern, efficient formats for the web.
- HEIC / HEIF: the iPhone's compact photo format.
- TIFF: large lossless files used for scans and print.
- BMP: uncompressed legacy bitmaps.
- RAW (CR2, NEF, ARW, DNG): unprocessed sensor data from cameras.
- SVG: scalable vector graphics, text-based drawings that stay sharp at any size.
- ICO: icons for websites and Windows.
Audio
- MP3: lossy, universal.
- M4A / AAC: lossy, better than MP3 at the same size.
- OGG / Opus: open lossy formats; Opus is superb for voice.
- FLAC / ALAC: lossless compressed.
- WAV / AIFF: uncompressed.
- AMR, WMA: older phone and Windows formats.
Video
- MP4: the most compatible container, usually H.264 video and AAC audio.
- MOV: Apple's QuickTime container.
- MKV: flexible container for many audio and subtitle tracks.
- WebM: open format for the web (VP8/VP9/AV1).
- AVI, WMV, FLV: legacy formats.
- 3GP: small clips from feature phones.
Documents and archives
- PDF: fixed-layout documents that look the same everywhere.
- DOCX / DOC, ODT: editable word-processor documents.
- PPTX / PPT, ODP: presentations.
- XLSX / CSV: spreadsheets and plain tabular text.
- TXT: plain text with no formatting.
- ZIP, RAR, 7Z: archives that bundle and compress many files.
Why a file will not open
- No program supports the codec or format. Converting to a mainstream format fixes it.
- The file is damaged. A partial download or interrupted copy produces corrupt files.
- The extension is wrong. The data is one format but the name claims another.
- It is protected. Passwords and digital rights management block opening.
- The file is too new. A format version or feature the program predates.
Choosing a format: a decision guide
| You want to... | Choose |
|---|---|
| Share a photo with anyone | JPG |
| Keep a screenshot sharp or transparent | PNG |
| Make a web page faster | WebP or AVIF |
| Share music everywhere | MP3 or M4A |
| Archive music perfectly | FLAC |
| Send a video that plays on every device | MP4 (H.264) |
| Send a document that looks the same everywhere | |
| Edit a document together | DOCX or ODT |
Converting safely
Converting between formats rarely harms files when done once from a good source. Remember three rules: keep the original, avoid repeated lossy conversions, and never expect a conversion to add quality that was never there. Our conversion pages explain what changes for each popular pair, such as HEIC to JPG or WAV to MP3, and the converters themselves handle many formats in one place.
How to find out what a file really is
Most formats start with a recognisable signature, called a magic number. PDF files begin with %PDF, PNG files with the bytes 89 50 4E 47, JPEG with FF D8 FF, ZIP and Office documents with PK, and MP3 with ID3 or a frame sync. Programs use these signatures to decide how to read a file regardless of its name, and good upload systems check them to reject disguised files. On a computer, the file properties dialog or a command such as file on Linux and macOS reports the detected type.
Office files are secretly ZIP archives
DOCX, XLSX and PPTX files are ZIP archives containing XML documents and media. Renaming one to .zip and opening it shows the pieces. That is why a damaged Office file can sometimes be partly recovered, and why such files should not be trusted from unknown senders: they can hold embedded objects.
Lossy to lossy: the conversion chain to avoid
Every lossy conversion discards a bit more. A photo that goes HEIC to JPG to WebP to JPG has been compressed three times. Keep one master in the best format you have, and always convert from the master. Lossless sources such as PNG, TIFF, FLAC and WAV are safe to convert from many times.
Open versus proprietary
Open formats (PNG, OGG, FLAC, ODT, PDF) are documented publicly and are less likely to become unreadable. Proprietary formats can lock you to one vendor and one version of software. For documents you want to open in twenty years, favour open, widely implemented formats, and keep a PDF copy of anything that matters.