devkult_
tools30converters34
home/mime/.mid

.mid MIME type

MIDI fileaudio

audio/midi

Standard MIDI files: note and controller events, not recorded sound. Unregistered, but universal.

MIME typeaudio/midi
Extensions.mid, .midi
Also seen asaudio/x-midi
Content-Typeaudio/midi
Compress in transit?Yes — enable gzip or Brotli
File signature4D 54 68 64 (MThd)

Good to know

  • <audio> can't play MIDI because there's no audio in the file. Render it with a synthesizer and a SoundFont (for example on the Web Audio API), or convert it to MP3 on the server.
  • The Web MIDI API talks to MIDI hardware; it doesn't play .mid files.

Serve .mid files with the right type

The response header to send:

Content-Type: audio/midi

Most servers pick the type from the file extension. If yours sends the wrong one, map it explicitly:

nginx (inside the types block in mime.types)
audio/midi mid midi;
Apache (.htaccess or server config)
AddType audio/midi .mid .midi
Express
res.set("Content-Type", "audio/midi");
Python
import mimetypes

mimetypes.add_type("audio/midi", ".mid")
mimetypes.add_type("audio/midi", ".midi")
HTML file input
<input type="file" accept=".mid,.midi,audio/midi">

Check it

See what a server sends for a file, and what type a local file really is by its contents:

curl -sI https://example.com/file.mid | grep -i '^content-type:'
file --mime-type file.mid

Frequently asked questions

What is the MIME type for .mid files?

audio/midi. You may also see audio/x-midi, but audio/midi is the one to send. The same type covers .midi.

What Content-Type header should a .mid file be served with?

Content-Type: audio/midi. It compresses well, so let the server apply gzip or Brotli.

How can I tell if a file is really a .mid?

Check its bytes rather than the extension: MID files start with 4D 54 68 64 (MThd). On the command line, file --mime-type name.mid does this for you.

Related types

Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options