{
  "schemaVersion": 1,
  "contentVersion": "ca42e61ede0a24f789d7287a0001244ad22f4abf",
  "id": "docs/codecs/audio/flac",
  "collection": "docs",
  "title": "FLAC",
  "description": "FLAC is the standard open lossless audio codec; this page covers when to use it, the flac and FFmpeg commands, and what the compression levels actually do.",
  "canonicalUrl": "https://encode.wiki/codecs/audio/flac/",
  "apiUrl": "https://encode.wiki/api/v1/documents/docs/codecs/audio/flac.json",
  "markdownUrl": "https://encode.wiki/api/v1/markdown/docs/codecs/audio/flac.md",
  "status": "current",
  "tags": [
    "migrated"
  ],
  "license": "CC BY-SA 4.0",
  "dates": {
    "lastVerified": "2026-10-08T00:00:00.000Z"
  },
  "authors": [],
  "sources": [
    {
      "title": "RFC 9639 — Free Lossless Audio Codec (FLAC)",
      "url": "https://www.rfc-editor.org/rfc/rfc9639",
      "accessedAt": "2026-10-08T00:00:00.000Z"
    },
    {
      "title": "FLAC 1.5.0 release",
      "url": "https://github.com/xiph/flac/releases/tag/1.5.0",
      "accessedAt": "2026-10-08T00:00:00.000Z"
    },
    {
      "title": "flac command-line documentation",
      "url": "https://xiph.org/flac/documentation_tools_flac.html",
      "accessedAt": "2026-10-08T00:00:00.000Z"
    },
    {
      "title": "FFmpeg codecs documentation — flac",
      "url": "https://ffmpeg.org/ffmpeg-codecs.html#flac-2",
      "accessedAt": "2026-10-08T00:00:00.000Z"
    },
    {
      "title": "MDN audio codec guide",
      "url": "https://developer.mozilla.org/en-US/docs/Web/Media/Guides/Formats/Audio_codecs",
      "accessedAt": "2026-10-08T00:00:00.000Z"
    }
  ],
  "provenance": {
    "originUrl": "https://github.com/av1-community-contributors/codec-wiki/blob/37c3317fd058b23c71a87679bed5619a98f77752/docs/audio/FLAC.mdx",
    "originCommit": "37c3317fd058b23c71a87679bed5619a98f77752",
    "migratedAt": "2026-08-21T00:00:00.000Z",
    "modified": true,
    "originPath": "docs/audio/FLAC.mdx"
  },
  "headings": [
    {
      "depth": 2,
      "text": "Encoding",
      "anchor": "encoding"
    },
    {
      "depth": 3,
      "text": "Compression levels",
      "anchor": "compression-levels"
    },
    {
      "depth": 2,
      "text": "Tags, cover art and metadata",
      "anchor": "tags-cover-art-and-metadata"
    },
    {
      "depth": 2,
      "text": "Containers and compatibility",
      "anchor": "containers-and-compatibility"
    },
    {
      "depth": 2,
      "text": "Decoding and converting",
      "anchor": "decoding-and-converting"
    },
    {
      "depth": 2,
      "text": "See also",
      "anchor": "see-also"
    }
  ],
  "sections": [
    {
      "id": "_preamble",
      "title": "Page introduction",
      "depth": 0,
      "canonicalUrl": "https://encode.wiki/codecs/audio/flac/",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/flac/_preamble.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/flac/_preamble.md",
      "checksum": "d5ba84687232750a21ae64c7d763b2490c377bcddf1e69dcffc6aadfdb8a91f8",
      "bytes": 657
    },
    {
      "id": "encoding",
      "title": "Encoding",
      "depth": 2,
      "anchor": "encoding",
      "canonicalUrl": "https://encode.wiki/codecs/audio/flac/#encoding",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/flac/encoding.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/flac/encoding.md",
      "checksum": "7950c3e24e3212e4570e4b730b236d9337f43e865eba2df97f7c815a0b60764d",
      "bytes": 1008
    },
    {
      "id": "compression-levels",
      "title": "Compression levels",
      "depth": 3,
      "anchor": "compression-levels",
      "canonicalUrl": "https://encode.wiki/codecs/audio/flac/#compression-levels",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/flac/compression-levels.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/flac/compression-levels.md",
      "checksum": "c9abf0aa5897cf8f9f7ce682c97dae499bc85b05b7ef3911668eeaafad48719e",
      "bytes": 704
    },
    {
      "id": "tags-cover-art-and-metadata",
      "title": "Tags, cover art and metadata",
      "depth": 2,
      "anchor": "tags-cover-art-and-metadata",
      "canonicalUrl": "https://encode.wiki/codecs/audio/flac/#tags-cover-art-and-metadata",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/flac/tags-cover-art-and-metadata.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/flac/tags-cover-art-and-metadata.md",
      "checksum": "b7752a686d479af4f2abfec5c6fb816b4064bc572a9a2b26e4af3da069ed8d1e",
      "bytes": 305
    },
    {
      "id": "containers-and-compatibility",
      "title": "Containers and compatibility",
      "depth": 2,
      "anchor": "containers-and-compatibility",
      "canonicalUrl": "https://encode.wiki/codecs/audio/flac/#containers-and-compatibility",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/flac/containers-and-compatibility.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/flac/containers-and-compatibility.md",
      "checksum": "b945731bcdea99de0401970775ec2404f76877f48c10724a006320600a106410",
      "bytes": 651
    },
    {
      "id": "decoding-and-converting",
      "title": "Decoding and converting",
      "depth": 2,
      "anchor": "decoding-and-converting",
      "canonicalUrl": "https://encode.wiki/codecs/audio/flac/#decoding-and-converting",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/flac/decoding-and-converting.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/flac/decoding-and-converting.md",
      "checksum": "9429b03ccea6a87c8df606347bddf236c0511ac6d97f12f8c1a884c73cfc8616",
      "bytes": 242
    },
    {
      "id": "see-also",
      "title": "See also",
      "depth": 2,
      "anchor": "see-also",
      "canonicalUrl": "https://encode.wiki/codecs/audio/flac/#see-also",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/flac/see-also.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/flac/see-also.md",
      "checksum": "c67fd5a6788976bdf2e3a6847baf479b6ec87c0088b72b772726e73e71bb7054",
      "bytes": 210
    }
  ],
  "outboundReferences": [
    "/codecs/audio/aac/",
    "/codecs/audio/alac/",
    "/codecs/audio/opus/",
    "/codecs/audio/wavpack/"
  ],
  "checksum": "0968a68dc25dce115ebc6643375888691fbb25d736e54fb627581926c934113e",
  "contentFormat": "markdown",
  "markdown": "FLAC (Free Lossless Audio Codec) compresses PCM audio to roughly half its size and decodes back to identical samples. It is open, fast to decode, plays almost everywhere, has good tagging, and is the default choice for music archives and lossless downloads. Use it unless you are locked into Apple's ecosystem ([ALAC](/codecs/audio/alac/)) or need something FLAC lacks, such as [WavPack](/codecs/audio/wavpack/)'s float support or hybrid mode.\n\nFLAC holds 4–32-bit integer PCM with 1–8 channels. It cannot store floating-point audio or DSD. Encoding a lossy source (MP3, AAC, Opus) to FLAC only preserves the damage at several times the size, so don't.\n\n## Encoding\n\nWith the reference encoder:\n\n```sh\nflac -8 -V input.wav -o output.flac\n```\n\nOr with FFmpeg:\n\n```sh\nffmpeg -i input.wav output.flac\n```\n\n`-V` verifies the encode by decoding it as it goes. Use `flac -t file.flac` any time to test a file; it checks the MD5 of the audio stored in the header.\n\n### Compression levels\n\nThe levels only trade encoding time against file size. Every level decodes to the same samples, and decoding speed barely changes.\n\n| Tool | Levels | Default | Notes |\n| --- | --- | --- | --- |\n| `flac` | `-0` … `-8` | `-5` | `-8` is `--best`. Add `-e` for an exhaustive model search, which is very slow for a tiny gain. |\n| FFmpeg | `-compression_level 0` … `12` | 5 | 0–8 roughly mirror `flac`'s levels. 11 and 12 allow LPC orders up to 32, which takes the file outside the streamable subset at 48 kHz and below. |\n\nThe gap between `-5` and `-8` is typically a percent or two, so the default is fine for most work. FLAC 1.5.0 can use several threads (`-j`) when encoding.\n\n## Tags, cover art and metadata\n\nFLAC stores tags in a Vorbis comment block, cover art in a PICTURE block and seek points in a SEEKTABLE. `metaflac` edits these without touching the audio:\n\n```sh\nmetaflac --list output.flac\nmetaflac --set-tag=\"ARTIST=Name\" --import-picture-from=cover.jpg output.flac\n```\n\n## Containers and compatibility\n\nPlain `.flac` is the normal form. FLAC can also live in Ogg (`flac --ogg`, usually `.oga`), Matroska/`.mka`, and MP4. Native FLAC plays in all current browsers and most hardware; Ogg FLAC and FLAC in MP4 are less widely supported.\n\nThe format has a \"streamable subset\" that restricts block sizes, LPC order and sample-rate signalling so hardware decoders can cope. `flac` stays inside it unless you pass `--lax`, and FFmpeg does up to `-compression_level 10`; stay there if the files are headed for hardware players.\n\nCheck 5.1 and 7.1 files on the device you care about, since some players ignore the channel layout.\n\n## Decoding and converting\n\n```sh\nflac -d input.flac -o output.wav\nffmpeg -i input.flac output.wav\n```\n\nTo get the original WAV back byte for byte, including non-audio chunks, pass `--keep-foreign-metadata` to both the encode and the decode.\n\n## See also\n\n- [ALAC](/codecs/audio/alac/) and [WavPack](/codecs/audio/wavpack/) for the other lossless options\n- [Opus](/codecs/audio/opus/) and [AAC](/codecs/audio/aac/) for lossy delivery from a FLAC master\n"
}
