Which File Format Should I Use?
Format choice should follow what you're actually trying to do, not just habit. This guide breaks it down by real situation — what you're building, sharing, or archiving — with a direct link to a real sample file for whichever format fits.
Images
The right image format depends almost entirely on where the image is going — a web page, a print job, or an icon slot each have different priorities.
Photos on a website, need the smallest file at good quality
Use WebP
25-35% smaller than JPEG at similar quality, full browser support since 2020.
Smallest possible file, browser support isn't a concern
Use AVIF
15-25% smaller than WebP again — the current best-in-class compression for photos.
Need it to work absolutely everywhere, including old software
Use JPG
Universal support going back decades — the safe default when compatibility trumps size.
Screenshots, logos, or anything with sharp edges/text
Use PNG
Lossless compression handles flat colors and text edges without JPEG's blur artifacts.
Logos or icons that need to scale to any size
Use SVG
Vector format — resizes infinitely with zero quality loss, tiny file size for simple graphics.
A simple animation (not a full video)
Use GIF
Universally supported animated format — WebP/AVIF are smaller but GIF still has no compatibility questions.
A website favicon
Use ICO
The one format every browser checks by default at /favicon.ico, bundles multiple sizes in one file.
Scanning documents, print production, or archival
Use TIFF
Lossless, high bit-depth, built for preserving every detail rather than minimizing size.
Audio
Audio format choice mostly comes down to one question: does quality loss actually matter for this use case?
General listening, sharing music, most everyday use
Use MP3
Small files, universal support, quality loss is imperceptible to most listeners at reasonable bitrates.
Archiving a master recording or audiophile-grade listening
Use FLAC
Fully lossless — the exact original waveform, just compressed, nothing thrown away.
Uncompressed audio for editing/production
Use WAV
Raw, uncompressed PCM audio — the standard intermediate format in audio production workflows.
Open-source projects or games, avoiding licensing concerns
Use OGG
Patent-free container format, no licensing fees — common in game engines and Linux tooling.
Documents
Pick based on whether the document needs to stay editable, look identical everywhere, or hold structured data.
A document that must look identical on every device
Use PDF
Fixed layout — fonts, spacing, and page breaks render exactly the same regardless of viewer or OS.
A document people need to edit collaboratively
Use DOCX
The default editable word-processing format, universal support in Word, Docs, and LibreOffice.
Tabular data, spreadsheet with formulas/formatting
Use XLSX
Standard spreadsheet format since Excel 2007 — formulas, multiple sheets, styling all supported.
Plain tabular data for import/export between systems
Use CSV
The simplest, most universally parseable data interchange format — every tool reads CSV.
Tabular data where values might contain commas
Use TSV
Tab-delimited avoids the comma-escaping ambiguity that trips up CSV parsers.
A slide deck
Use PPTX
Standard presentation format, opens natively in PowerPoint, Google Slides, and Keynote.
An ebook
Use EPUB
Reflowable text that adapts to any screen size — the standard format for e-readers and reading apps.
Rich text that needs to survive moving between old software
Use RTF
Human-readable markup instead of a binary/zip format — safest export when DOCX support is uncertain.
Archives
Archive format choice usually comes down to platform convention and how much compression actually matters.
Sharing a compressed folder with anyone, any OS
Use ZIP
Every OS can create and extract ZIP natively — the safest default for compatibility.
Maximum compression, don't mind slower compress times
Use 7Z
Beats ZIP and RAR on compression ratio via LZMA2 — free and open-source too.
Packaging files on Linux/Unix, preserving permissions
Use TAR
Bundles files with exact permissions and ownership intact — the standard Unix packaging format.
Compressing a single file (often paired with TAR)
Use GZ
Standalone gzip compression — combines with TAR for the ubiquitous .tar.gz format.
Code & Config
Config format choice is about how strict you need type-safety to be versus how easy it is to hand-edit.
API responses, data interchange between systems
Use JSON
The universal data format for web APIs — every language has a parser, strict and unambiguous.
Config files that need to be easy for humans to hand-edit
Use YAML
Minimal punctuation, indentation-based structure — popular for CI/CD and app configs.
Config files, especially in Rust or Python projects
Use TOML
Explicit typing avoids YAML's implicit-type ambiguity — the standard for Cargo.toml/pyproject.toml.
Legacy config format, simple key-value pairs
Use INI
Dead simple to hand-edit — still common in php.ini, Windows apps, and game configs.
Streaming or appending records without rewriting a file
Use JSONL
One JSON object per line — append a record by writing a line, no enclosing array to rewrite.
Documenting a system diagram alongside your code
Use MMD (Mermaid)
Diagrams as text — lives in version control, renders natively on GitHub and GitLab.
Fonts
Web fonts and desktop fonts have different priorities: download size versus universal installability.
A web font loaded via @font-face
Use WOFF2
Brotli-compressed specifically for web delivery — the smallest option with full glyph fidelity.
Web font fallback for older browsers
Use WOFF
Predates WOFF2 — still worth generating as a fallback for browsers that don't support WOFF2.
A font installed system-wide on desktop
Use TTF
The most universally supported installable format across every OS and design tool.
Professional typography with advanced OpenType features
Use OTF
Supports ligatures, alternate glyphs, and small caps that plain TTF can't carry.
Need exact MIME types instead of a recommendation? See the File Extension & MIME Type Cheat Sheet for a full reference table.