FLAC

On this page 7

FLAC (Free Lossless Audio Codec) is an open, royalty-free lossless audio codec that compresses PCM audio without discarding any information, so decoding returns a bit-identical copy of the original samples. Among audio formats and codecs, it is the most widely supported lossless option for music archiving, high-resolution distribution and personal libraries.

A FLAC file typically takes about 50 to 70 percent of the size of the equivalent WAV file, depending on the music. The format is specified openly, was standardized by the IETF as RFC 9639, and has reference encoders and decoders available as free software.

How FLAC compresses audio without loss

FLAC splits the audio into blocks of samples, commonly 4,096 samples per channel, and compresses each block independently. Within a block, the encoder first exploits inter-channel redundancy, for example by coding the left channel and the difference between channels instead of two full channels.

The central step is linear prediction: the encoder fits a predictor of up to 32 coefficients that estimates each sample from the preceding ones, and stores only the coefficients and the prediction residual. Because music changes smoothly from sample to sample, the residual values are small and can be stored with far fewer bits.

The residual is then coded with Rice coding, an entropy code that represents small numbers in very few bits. Every frame carries a CRC checksum, and the file header stores an MD5 signature of the original audio, so a decoder can verify that the output matches exactly.

StageWhat it doesWhy it saves space
BlockingSplits audio into short framesLets the encoder adapt to changing music
Channel decorrelationCodes side or difference signalsRemoves information shared by channels
Linear predictionEstimates samples from earlier onesLeaves only small residual values
Rice codingEntropy-codes the residualUses fewer bits for small numbers
ChecksumsAdds CRC per frame and MD5 per fileDetects corruption, adds negligible size
Main stages of FLAC encoding

Compression levels and supported parameters

The reference encoder offers compression levels from 0 to 8. Higher levels search harder for good predictors, which slows encoding but changes the output size only by a few percent; decoding speed stays almost the same at every level, and the audio is identical in all cases.

ParameterSupported rangeCommon values
Bit depth4 to 32 bits per sample16-bit and 24-bit
Sample rateUp to several hundred kHz44.1, 48, 96 and 192 kHz
Channels1 to 8Stereo, sometimes 5.1
Compression level0 to 8Default level 5
Typical size versus WAVAbout 50 to 70 percentLower for sparse, quiet music
Key FLAC parameters

Compression ratio depends on the content: solo piano or quiet classical music compresses well, while dense, heavily limited rock or electronic music and recordings with substantial noise compress least. Metadata is stored in Vorbis comment tags, and cover art can be embedded in a picture block.

FLAC compared with other audio formats

FLAC sits between uncompressed PCM and lossy codecs: it saves storage like a codec but keeps every bit like WAV. Its closest relative is ALAC, which uses similar techniques and offers similar compression.

FormatTypeTypical size versus WAVTypical use
WAVUncompressed PCM100 percentRecording and editing
FLACLossless, openAbout 50 to 70 percentArchiving and lossless distribution
ALACLosslessAbout 50 to 70 percentLossless audio on Apple platforms
MP3LossyAbout 10 to 20 percentLegacy downloads and players
AACLossyAbout 10 to 20 percentStreaming and video soundtracks
OpusLossyOften under 10 percentVoice, streaming, low latency
FLAC and neighboring audio formats

A key advantage of lossless audio is transcoding without generation loss: a FLAC master can be converted to any lossy format repeatedly, each time from the full-quality source. Converting one lossy format into another, by contrast, compounds artifacts.

When to use FLAC and when not to

FLAC is the right choice when exact preservation matters and playback devices support it. It is less suitable during active production, where editing software and delivery specifications usually expect WAV or BWF files.

SituationRecommended formatReason
Archiving a CD collectionFLACExact copy at about half the space
Studio editing sessionWAVUniversal support in editing software
Selling lossless downloadsFLAC, often with ALACBroad player compatibility
Mobile listening with little storageAAC or OpusMuch smaller files
Broadcast deliveryWAV or BWFRequired by most specifications
Choosing FLAC by situation

Common misconceptions about FLAC

  • Higher compression levels do not sound better or worse: every level decodes to identical audio.
  • A FLAC file is only as good as its source: converting an MP3 to FLAC keeps the MP3’s losses in a larger file.
  • High-resolution FLAC is not automatically better: a 24-bit / 192 kHz file mainly adds size unless the recording and playback chain benefit from it.
  • Lossless does not mean uncompressed: the data is compressed, but nothing is thrown away.

In plain words

FLAC works like a zip file made especially for music. It packs a recording into roughly half the space. When the file is played, it unpacks to exactly the same sound that went in.

Formats such as MP3 save space by throwing away sounds that listeners are unlikely to notice. FLAC throws away nothing. That makes it the choice for people who want a perfect copy of their music, and are willing to use more storage than with MP3.

A real-world example

A community radio station digitizes 2,000 CDs from its music library before the discs deteriorate. Ripped as WAV, the collection would need about 1.4 TB; encoded as FLAC at level 8, it fits in roughly 850 GB, with album, artist and track tags stored inside each file.

Each rip is verified against the disc, and the MD5 signature stored in every FLAC file lets the archivist confirm years later that no file has been corrupted. When the station needs MP3 files for an online player, it converts them directly from the FLAC archive, so the originals stay untouched and the conversion can be repeated whenever a better codec appears.