DevToolsmith

FLAC MIME Type

audio/flac is the MIME type for FLAC lossless audio. Here is the Content-Type header to send, the file signature, and how to configure servers and code.

MIME type
audio/flac
Extensions
.flac
Content-Type header
audio/flac
Registered
Yes, with IANA
Compress with gzip
No, it is already compressed
Category
Audio

About FLAC audio files

Lossless compression, typically about half the size of WAV with identical sound. All current browsers play FLAC in <audio>. Older systems used audio/x-flac.

Other types seen for these files: audio/x-flac . Accept them when reading uploads, but send audio/flac yourself.

File signature

FLAC files start with 66 4C 61 43 ("fLaC"). The extension and the type a browser reports for an upload both come from the file name, so check these bytes on the server before trusting a file.

Serve .flac with the right Content-Type

Response header
Content-Type: audio/flac
nginx (a line in the types { } block of mime.types)
audio/flac flac;
Apache (.htaccess or server config)
AddType audio/flac .flac
Caddy
@flac path *.flac
header @flac Content-Type "audio/flac"
Check what a server sends
curl -sI https://example.com/file.flac | grep -i '^content-type'
# Content-Type: audio/flac

Set the type in code

Node.js (Express)
res.set('Content-Type', 'audio/flac');
// Or make the browser download it:
res.attachment('file.flac');
Python
import mimetypes

mimetypes.add_type('audio/flac', '.flac')  # if your system doesn't know it
mimetypes.guess_type('file.flac')[0]  # 'audio/flac'
Go
mime.AddExtensionType(".flac", "audio/flac")
w.Header().Set("Content-Type", "audio/flac")

Accept .flac uploads

HTML
<input type="file" accept=".flac,audio/flac">

The accept attribute only filters the file picker; users can still choose another file. Listing the extension as well as the type matters, because operating systems don’t always report the type you expect.

Related types

  • .wav (audio/wav): WAV audio
  • .mp3 (audio/mpeg): MP3 audio
  • .ogg (audio/ogg): Ogg audio

More audio

.m4a , .aac . Look up any extension or type with the MIME type lookup.

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What is the MIME type for .flac files?

audio/flac. You may also see audio/x-flac, which is older or unofficial; send audio/flac. The full header is "Content-Type: audio/flac".

Why does my server send the wrong Content-Type for .flac?

Web servers pick the type from the file extension using a table (mime.types in nginx and Apache). If .flac is missing from that table, they send a default such as application/octet-stream or text/plain. Add the mapping as shown on this page, then check the response with "curl -sI".

How can I check that a file really is FLAC?

Look at the first bytes rather than the extension or the type the browser reports, which both come from the file name. FLAC files start with 66 4C 61 43 ("fLaC"). The MIME type lookup on this site reads them for you when you drop a file on it.