FLAC (Free Lossless Audio Codec) — Complete Guide
What Is FLAC?
FLAC (Free Lossless Audio Codec) is an open-source lossless audio compression format developed by Josh Coalson and released by the Xiph.Org Foundation in 2001. Unlike MP3, AAC, and OGG Vorbis — all lossy codecs that permanently discard audio information — FLAC preserves every single bit of the original audio data while still reducing file size by 40–60 % compared to uncompressed PCM (WAV/AIFF).
The "Free" in FLAC refers to its royalty-free, open-source nature. Anyone can implement a FLAC encoder or decoder without licensing fees. The reference implementation is published under BSD-like and LGPL licences.
FLAC is the dominant lossless audio format in consumer and audiophile markets, supported natively on Android, major Linux distributions, most dedicated audio players, and all professional audio workstations.
How FLAC Achieves Lossless Compression
Step 1: Channel Decorrelation
For stereo audio, FLAC can optionally subtract the right channel from the left (mid-side stereo), reducing the correlation between channels. Since stereo recordings are highly similar in both channels, the difference signal has much smaller amplitude and compresses better.
Step 2: Linear Predictive Coding (LPC)
FLAC's core compression technique. For each block of samples, FLAC fits a linear predictor — a mathematical model that predicts the next sample based on previous samples:
predicted[n] = a₁·sample[n-1] + a₂·sample[n-2] + ... + aₖ·sample[n-k]
The predictor order (k) ranges from 1 to 32. Higher orders capture more complex patterns but add overhead. FLAC tests multiple orders and selects the best fit automatically.
Step 3: Residual Calculation
The residual (actual - predicted) for each sample is computed. For well-predicted audio (sustained notes, slowly varying signals), residuals are very small numbers — much easier to compress than raw samples.
Step 4: Entropy Coding (Rice Coding)
Residuals are encoded using Rice coding, a special case of Golomb coding optimised for signals with exponential probability distributions. Each block is tested with several Rice parameter values; the one producing smallest output is chosen. Rice coding is computationally simpler than Huffman coding and allows bitstream framing that simplifies decoding.
Step 5: Frame Structure
FLAC data is organised into independently decodable frames, each containing a fixed or variable number of samples. Frame independence enables:
- Random seek — jump to any point in the audio without decoding from the start
- Error isolation — a corrupt frame affects only that region; surrounding audio is unaffected
- Parallel decoding — frames decoded independently on multiple cores
FLAC Compression Levels
FLAC offers compression levels 0–8, controlling the trade-off between encoding speed and file size:
| Level | Encoding Speed | File Size | Notes |
|---|---|---|---|
| 0 | Fastest | Largest | Minimal predictor search; near real-time |
| 1 | Very fast | ~2% larger than level 5 | Good for embedded encoding |
| 2 | Fast | ~1% larger | Reasonable default for streaming |
| 3 | Moderate | ~0.5% larger | |
| 4 | Moderate | ~0.2% larger | |
| 5 | Default | Reference | Balance of speed and size |
| 6 | Slower | ~0.1% smaller | |
| 7 | Slow | ~0.2% smaller | High-effort search |
| 8 | Slowest | Smallest | Exhaustive predictor search |
Key insight: the difference between level 0 and level 8 is only ~5–10 % in file size, while encoding speed may differ by 10–20x. For most use cases, level 5 (the default) is optimal. Level 8 is justified only when storage space is the critical constraint.
Supported Sample Rates and Bit Depths
FLAC is extremely flexible regarding audio format:
- Sample rates: 1 Hz to 655,350 Hz (practically: 8 kHz to 384 kHz; common values: 44.1, 48, 88.2, 96, 176.4, 192 kHz)
- Bit depths: 4 to 32 bits per sample (common: 16-bit CD quality, 24-bit studio quality)
- Channels: 1 to 8 channels (mono to 7.1 surround)
This makes FLAC suitable for CD archival (16-bit/44.1 kHz), studio masters (24-bit/96 kHz), and high-resolution downloads (24-bit/192 kHz).
Metadata: Vorbis Comments
FLAC uses Vorbis Comment metadata blocks — a simple, human-readable tag format using UTF-8 key=value pairs:
TITLE=Symphony No. 9 in D Minor, Op. 125 — IV. Finale
ARTIST=Ludwig van Beethoven
ALBUM=Beethoven: The Complete Symphonies
DATE=1824
TRACKNUMBER=4
GENRE=Classical
COMMENT=Recorded in Vienna Philharmonic Hall, 2018
REPLAYGAIN_TRACK_GAIN=-6.5 dB
REPLAYGAIN_TRACK_PEAK=0.98765
Vorbis Comments support unlimited custom tags, allowing libraries to add arbitrary metadata (recording engineer, mastering chain, album art embedded as base64, BPM, ISRC codes, etc.).
Album Art
FLAC supports embedded album art in a dedicated PICTURE metadata block. The image (typically JPEG or PNG) is base64-encoded and stored inside the FLAC file, allowing media players to display artwork without external image files.
Seek Table
Large FLAC files include an optional SEEKTABLE metadata block — a lookup table of (sample_number, byte_offset) pairs at regular intervals. This enables near-instant seeking to any position without scanning the entire file. The seektable covers one seek point every 10 seconds by default.
Native Format: FLAC Files vs. Ogg-FLAC
FLAC audio can be stored in two container formats:
- Native FLAC (.flac) — the standard format; self-contained; maximum compatibility
- Ogg-FLAC (.oga) — FLAC data within Ogg container; inherits Ogg streaming benefits; used in some Linux streaming applications
For archival and playback, native FLAC is universally recommended. Ogg-FLAC adds Ogg overhead with no practical benefit for typical use.
Platform and Software Support
Full Native Support
- Android (3.1+) — native; supported in Google Play Music, Poweramp, VLC
- Linux — universal; FLAC is natively supported by every major audio framework (ALSA, PulseAudio, JACK, GStreamer, libavcodec)
- Windows — Windows Media Player and Groove Music support FLAC natively since Windows 10 Anniversary Update
- macOS — QuickTime and iTunes/Apple Music support FLAC since macOS 10.13 (High Sierra)
- Dedicated audio players — FiiO, Astell&Kern, Pono, Sony Walkman Hi-Res, most audiophile DAPs
- Network-Attached Storage (NAS) — Plex, Emby, Jellyfin stream FLAC natively to compatible clients
Limited or No Support
- iOS — Apple Music on iOS supports FLAC since iOS 11; many third-party apps do not
- Some streaming platforms — Spotify transcodes everything to OGG/MP3; TIDAL offers FLAC streaming (Masters tier); Qobuz is fully FLAC-based
- Very old hardware players — iPods (pre-classic) and older MP3 players lack FLAC decoders
FLAC vs. Other Lossless Formats
| Format | Compression | Metadata | Hardware Support | Open |
|---|---|---|---|---|
| FLAC | 40–60 % vs WAV | Vorbis Comments | Excellent | Yes |
| ALAC (Apple Lossless) | 40–60 % vs WAV | iTunes tags | Apple-centric | Yes (2011+) |
| WMA Lossless | 40–60 % vs WAV | ID3 | Windows-centric | No |
| APE (Monkey's Audio) | 50–70 % vs WAV | APEv2 | Limited | No |
| WAV | 0% (uncompressed) | Minimal | Maximum | Yes |
FLAC's combination of open-source, excellent hardware support, comprehensive metadata, and proven reliability makes it the clear choice for lossless archival.
File Size Comparison
For a 60-minute stereo album:
- WAV (uncompressed 16-bit/44.1 kHz): ~635 MB
- FLAC (level 5): ~250–350 MB (typical ~45 % reduction)
- FLAC (24-bit/96 kHz, hi-res): ~700 MB–1.2 GB (higher sample rate increases size)
- MP3 (320 kbps): ~144 MB (lossy; 77 % smaller than WAV)
- AAC (256 kbps): ~115 MB (lossy; 82 % smaller than WAV)
Converting FLAC Files
FLAC → MP3/AAC: Decode FLAC to PCM first, then encode to the target lossy format. This is the recommended path — no transcoding artefacts because FLAC is lossless. Result quality equals encoding directly from the original recording.
FLAC → WAV: Simple decompression; byte-for-bit identical PCM result. Useful for software requiring raw PCM input (some older DAWs, hardware devices).
FLAC → ALAC: Lossless-to-lossless; audio data is mathematically identical. Useful for Apple ecosystem integration.
MP3/OGG → FLAC: Compresses a lossy source without quality improvement. The FLAC file is larger but still contains the same lossy artefacts as the source. Useful only for storage standardisation, not quality improvement.
Related conversions
Common video conversions that pair well with this guide: