What is the MIDI file format?
A .midi file is a Standard MIDI File (SMF) - a binary sequence of musical performance events produced by synthesizers, keyboards, and digital audio workstations. The format stores note pitches, velocities, timing, controller changes, and instrument assignments, but contains no sampled audio. Playback quality depends entirely on the synthesizer or soundfont used for rendering.
.midi is byte-for-byte identical to .mid. The difference is purely the extension length: DOS's 8.3 filename limit forced the shorter .mid form, while modern operating systems accept the full .midi spelling. Some applications, notably Ableton Live, require renaming .midi to .mid before import.
The file begins with the four-byte marker MThd (the MIDI header chunk), followed by a 6-byte header declaring format type, track count, and timing resolution. One or more MTrk track chunks follow. Three format types exist: Format 0 stores all channels in a single track; Format 1 uses multiple synchronous tracks; Format 2 stores independent pattern sequences.
The Standard MIDI File 1.0 specification was published in 1988 by the MIDI Manufacturers Association and has remained stable ever since. MIDI 2.0 (2020) extends the underlying protocol but uses different clip formats; .midi sequences remain in widespread active use across DAWs, notation software, and hardware synthesizers.
Security & safety
RISK: LOWStandard MIDI File is passive event data with no embedded code or macros, so the format itself is harmless. Historical note: CVE-2012-0003 allowed code execution via a crafted MIDI in older Windows Media Player - long since patched. Keep OS and players updated. Main risk is disappointment: playback quality depends on the synthesizer/soundfont, not the file itself.
Format details
in a nutshellPrograms that open MIDI files
Technical details
deep spec| Magic bytes | `4D 54 68 64` (`MThd`) at byte offset 0, followed by `00 00 00 06` (header chunk length) |
| Byte order | Big-endian |
| Chunk structure | `MThd` header chunk + one or more `MTrk` track chunks; each chunk prefixed with a 4-byte type ID and 32-bit length |
| Format types | Format 0 - single track, all channels; Format 1 - multiple synchronous tracks; Format 2 - independent patterns |
| Timing resolution | Set in `MThd` division field: ticks per quarter note (e.g. 480 TPQN) or SMPTE time-code frames |
| Tempo encoding | Meta event `FF 51 03` stores microseconds per quarter note; default 500 000 µs (120 BPM) |
| Delta-time encoding | Variable-length quantity (VLQ) precedes each event; compact encoding, no fixed-size padding |
| Event types | Note-on/off, velocity, controller change, program change, pitch bend, aftertouch, SysEx, meta events (tempo, time signature, lyrics) |
| Channel capacity | 16 MIDI channels per track; channel 10 conventionally reserved for percussion |
| Relationship to .mid | Byte-for-byte identical to `.mid`; `.midi` is the long-form extension, accepted on modern OSes but rejected by DOS 8.3 naming |
| Typical file size | 1 KB - 100 KB; a few minutes of music typically under 50 KB |
| Karaoke variant | `.kar` files embed lyric meta events in a second track; otherwise identical to SMF Format 1 |
| MIDI 2.0 relationship | MIDI 2.0 (2020) extends the protocol but uses different clip formats; `.midi`/`.mid` SMF is not superseded |
| Released | Standard MIDI File 1.0 published 1988 (MIDI protocol 1983) |
| Latest version | SMF 1.0 (stable since 1988); MIDI 2.0 protocol (2020) uses different clip formats |
| Open standard | Yes · royalty-free |
| Specification | midi.org |
MIDI conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about MIDI files.