What does the Q15 format mean?
Q15 is a 16-bit signed format with 15 fraction bits and no integer bits apart from the sign, so it is Q0.15 in full. It covers -1 to 0.999969482421875 in steps of 2^−15, about 0.0000305.
DSP code stores fractions as scaled integers, and this fixed-point calculator shows what a decimal number becomes in Qm.n: the raw integer, hex, bit pattern and rounding error. It converts back too, and you can set the word layout, rounding and overflow behavior to match your DSP library or C code.
Excludes the sign bit: Q15 has m = 0.
One LSB is 2^−n.
Q0.15 bit pattern
0x0CCD
raw integer 3277, stores 0.100006103515625
Bit layout, most significant bit first
SignFraction
Multiply by 2n and round to an integer, where n is the number of fraction bits. In Q15, 0.1 × 32768 = 3276.8, which rounds to 3277 or 0x0CCD. That code stores 0.100006103515625, an error of 0.2 LSB. Divide the integer by 2n to convert back.
A Qm.n number is an ordinary two’s-complement integer that you agree to read as if its binary point sat n bits above the least significant bit. The hardware does integer math; the scale lives in your head and your comments.
The word length, range and resolution follow from m and n:
Vendors disagree on what m counts. TI writes a 16-bit word with one sign bit and 15 fraction bits as Q0.15, leaving the sign out of m. Arm’s CMSIS-DSP writes the same word as 1.15, counting the sign as an integer bit. The Q format calculator accepts either and shows both names.
Multiplying and adding change the format. With no bits dropped, for signed values in TI notation:
So Q15 × Q15 is Q1.30 in 32 bits, Q7.8 × Q7.8 is Q15.16 in 32 bits, and Q15 + Q15 is Q1.15 in 17 bits.
0.1 × 2¹⁵ = 3276.8, which rounds to 3277, or 0x0CCD. That code stores 0.100006103515625, so the error is 0.0000061 (0.2 LSB). A C cast truncates instead and gives 3276 (0x0CCC), an error of -0.8 LSB.
The top bit is set, so the 16-bit integer is negative: 0xE400 − 65536 = -7168. Dividing by 2¹² gives -1.75. Q3.12 covers -8 to 7.999755859375 in steps of 0.000244140625.
1.0 × 2¹⁵ = 32768, one past the largest code. Saturating gives 0x7FFF, which reads back as 0.999969482421875: wrong by one LSB. Wrapping gives 0x8000, which reads back as -1, the opposite sign. This is why DSP libraries saturate. For comparison, −1.5 in Q7.8 is in range and encodes as 0xFE80.
Exact limits. Names are in TI notation with the Arm name beside them for signed formats; Q7.24 is TI’s IQ24.
| Format | Arm name | Bits | Minimum | Maximum | Resolution |
|---|---|---|---|---|---|
| Q0.7 | Q1.7 | 8 | -1 | 0.9921875 | 0.0078125 |
| Q0.15 | Q1.15 | 16 | -1 | 0.999969482421875 | 0.000030517578125 |
| Q0.31 | Q1.31 | 32 | -1 | 0.9999999995343387126922607421875 | 0.0000000004656612873077392578125 |
| Q3.12 | Q4.12 | 16 | -8 | 7.999755859375 | 0.000244140625 |
| Q7.8 | Q8.8 | 16 | -128 | 127.99609375 | 0.00390625 |
| Q15.16 | Q16.16 | 32 | -32768 | 32767.9999847412109375 | 0.0000152587890625 |
| Q7.24 | Q8.24 | 32 | -128 | 127.999999940395355224609375 | 0.000000059604644775390625 |
| UQ8.8 | same | 16 | 0 | 255.99609375 | 0.00390625 |
| UQ0.16 | same | 16 | 0 | 0.9999847412109375 | 0.0000152587890625 |
| UQ16.16 | same | 32 | 0 | 65535.9999847412109375 | 0.0000152587890625 |
Values from the decimal to fixed-point converter above, rounded to nearest, with ties away from zero. These are the constants that end up in filter tables.
| Decimal | Q15 raw | Q15 hex | Q31 raw | Q31 hex |
|---|---|---|---|---|
| 0.99 | 32440 | 0x7EB8 | 2126008812 | 0x7EB851EC |
| 0.9 | 29491 | 0x7333 | 1932735283 | 0x73333333 |
| 0.75 | 24576 | 0x6000 | 1610612736 | 0x60000000 |
| 0.7071 | 23170 | 0x5A82 | 1518485688 | 0x5A8240B8 |
| 0.5 | 16384 | 0x4000 | 1073741824 | 0x40000000 |
| 0.25 | 8192 | 0x2000 | 536870912 | 0x20000000 |
| 0.1 | 3277 | 0x0CCD | 214748365 | 0x0CCCCCCD |
| 0.01 | 328 | 0x0148 | 21474836 | 0x0147AE14 |
| -0.1 | -3277 | 0xF333 | -214748365 | 0xF3333333 |
| -0.25 | -8192 | 0xE000 | -536870912 | 0xE0000000 |
| -0.5 | -16384 | 0xC000 | -1073741824 | 0xC0000000 |
| -1 | -32768 | 0x8000 | -2147483648 | 0x80000000 |
This fixed-point converter models words of 1 to 64 bits with m and n at zero or above. Formats whose scale lies outside the word (negative m or n) are not covered: rescale those by hand.
Q15 is a 16-bit signed format with 15 fraction bits and no integer bits apart from the sign, so it is Q0.15 in full. It covers -1 to 0.999969482421875 in steps of 2^−15, about 0.0000305.
Q7 is an 8-bit signed format with 7 fraction bits and no integer bits apart from the sign, so it is Q0.7 in full. It covers -1 to 0.9921875 in steps of 2^−7, which is 0.0078125.
Multiply by 2^15 (32768) and round to an integer. 0.1 × 32768 = 3276.8, which rounds to 3277, or 0x0CCD. To go back, divide the integer by 32768.
They name the same 16-bit word. TI notation does not count the sign bit in m, so it writes Q0.15 (or Q15 for short). Arm documents such as CMSIS-DSP count the sign bit, so they write 1.15. Always check which notation a datasheet or library uses before trusting the number of integer bits.
Two’s complement has one more negative code than positive. The largest Q15 code is 0x7FFF, which is 0.999969482421875, while 0x8000 is exactly -1. Converting 1.0 either saturates to 0x7FFF or wraps to 0x8000, which flips the sign.
A 32-bit Q1.30 (2.30 in Arm notation). Shift right by 15 to return to Q15 and saturate, because −1 × −1 = +1 is the one product that does not fit back in Q15.
A signed Qm.n covers −2^m to 2^m − 2^−n and an unsigned UQm.n covers 0 to 2^m − 2^−n. The resolution is 2^−n in both cases, and each integer bit you add doubles the range at the cost of one fraction bit in a fixed word.
Round if accuracy matters. Truncation can be off by nearly a full LSB and biases the result toward zero, while rounding keeps the error within half an LSB. For 0.1 in Q15, truncation gives 3276 and rounding gives 3277.
See all free electronics tools →
ProtoFlow is free AI PCB design software: describe a circuit and get a schematic with real parts, PCB layout with an autorouter, SPICE simulation and Gerber files. Native KiCad, Altium and EAGLE import and export. Free on macOS, Windows and Linux.
Free to start. No card required.