Free online MIDI tool
Online MIDI VLQ Encoder & Decoder
Encode or decode a MIDI variable-length quantity (VLQ) using hexadecimal, binary, decimal, or quarter-note durations. Convert delta time with PPQ and view every result as MIDI-ready bytes.
Decode a value
Decoded value
- Decimal
- Hexadecimal
- Binary
- Duration (quarter notes)
Encode a value
Encoded VLQ bytes
- Decimal bytes
- Hexadecimal bytes
- Binary bytes
What is a MIDI VLQ?
A variable-length quantity stores an unsigned integer in one to four bytes. Standard MIDI Files use VLQ values for delta times and for several length fields, allowing small numbers to take less space.
Each VLQ byte contains seven value bits. A most-significant bit of 1 means another byte follows; a most-significant bit of 0 marks the final byte. The decoder removes those continuation bits, while the encoder adds them to a normal integer.
How to use the online MIDI VLQ decoder
- Select hexadecimal, binary, or decimal input.
- Enter the encoded VLQ bytes. Compact hex such as
CB00and separated hex such asCB 00are both accepted. - Enter the MIDI file's PPQ value if you also want the delta time expressed in quarter notes.
- Read the decoded integer in decimal, hexadecimal, and binary.
How to encode a MIDI VLQ
- Select whether the normal value is hexadecimal, binary, decimal, or a duration in quarter notes.
- Enter the value. For a duration, also enter the MIDI file's PPQ; fractional tick results are rounded to the nearest whole tick.
- Read the encoded MIDI VLQ byte sequence in decimal, hexadecimal, and binary.
MIDI delta time and PPQ
For a metrical Standard MIDI File, PPQ means pulses—or ticks—per quarter note. Divide the decoded delta-time value by PPQ to find its musical duration in quarter notes:
quarter notes = decoded delta-time ticks ÷ PPQ
For example, CB 00 decodes to 9,600 ticks. At 9,600 PPQ, that is 1.0 quarter note. This calculation gives musical duration rather than seconds; converting to real time also requires the MIDI tempo.
| Encoded hex | Decoded ticks | Quarter notes |
|---|---|---|
00 | 0 | 0.0 |
7F | 127 | 0.0132291667 |
81 00 | 128 | 0.0133333333 |
CB 00 | 9,600 | 1.0 |
81 96 00 | 19,200 | 2.0 |
Accepted input formats
A MIDI VLQ contains one to four encoded bytes. In hexadecimal and binary modes, bytes may be compact or separated by spaces, commas, colons, or hyphens. The matching 0x and 0b prefixes are also accepted.
For decimal input, enter each encoded byte separately, such as 129 0, or enter the bytes as one packed decimal value, such as 33024.