# .mid MIME Type: audio/midi

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

- MIME type: `audio/midi`
- Extensions: .mid, .midi
- Also seen as: `audio/x-midi`
- Content-Type header: `audio/midi`
- Compress in transit: yes
- File signature: `4D 54 68 64`

## 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.

## Server configuration

### 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">
```

## FAQ

### 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

- [.mp3 — audio/mpeg](https://www.devkult.com/mime/mp3.md)
- [.wav — audio/wav](https://www.devkult.com/mime/wav.md)
- [.ogg — audio/ogg](https://www.devkult.com/mime/ogg.md)

Open the interactive page: https://www.devkult.com/mime/mid