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

Input format

Enter hexadecimal bytes, separated by spaces, or as one compact value (for example, 81 00 or 8100).

Pulses (ticks) per quarter note.

Try:

Decoded value

Decimal
19200
Hexadecimal
0x4B00
Binary
0b100101100000000
Duration (quarter notes)
2.0

Encode a value

Input format

Enter the normal decimal integer that you want to encode as a MIDI VLQ.

Used when the input format is Duration (quarter notes).

Try:

Encoded VLQ bytes

Decimal bytes
203 0
Hexadecimal bytes
CB 00
Binary bytes
11001011 00000000

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

  1. Select hexadecimal, binary, or decimal input.
  2. Enter the encoded VLQ bytes. Compact hex such as CB00 and separated hex such as CB 00 are both accepted.
  3. Enter the MIDI file's PPQ value if you also want the delta time expressed in quarter notes.
  4. Read the decoded integer in decimal, hexadecimal, and binary.

How to encode a MIDI VLQ

  1. Select whether the normal value is hexadecimal, binary, decimal, or a duration in quarter notes.
  2. Enter the value. For a duration, also enter the MIDI file's PPQ; fractional tick results are rounded to the nearest whole tick.
  3. 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.

MIDI VLQ examples at 9,600 PPQ
Encoded hex Decoded ticks Quarter notes
0000.0
7F1270.0132291667
81 001280.0133333333
CB 009,6001.0
81 96 0019,2002.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.