Fixed-Point Converter

Convert real numbers to signed Qm.n fixed-point binary representation.

Free Qm.n fixed-point converter. Turn any decimal into its scaled integer, two's-complement binary and hex form for a chosen integer/fractional bit split, with overflow detection and quantization error. Runs in your browser. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What does Qm.n mean?

Qm.n is a signed fixed-point format with m integer bits and n fractional bits, plus one sign bit, giving m+n+1 total bits. The stored integer equals the real value multiplied by 2 to the power n.

Fixed-point representation stores fractional numbers as plain integers by agreeing on an implicit scaling factor. It is the workhorse of digital signal processing (DSP), embedded firmware and FPGA designs, where floating-point hardware is expensive or absent. This converter encodes any decimal into a signed Qm.n format and shows you the exact bits.

How it works

A signed Qm.n number reserves:

  • 1 sign bit,
  • m bits for the integer part,
  • n bits for the fractional part,

for a total of m + n + 1 bits. To encode a value:

  1. Multiply the real value by 2^n (the scaling factor).
  2. Round to the nearest integer — this is the stored integer.
  3. Interpret that integer as a two’s-complement number of m + n + 1 bits.

To decode, you divide the stored integer by 2^n. The smallest representable step (resolution) is 2^-n, and the representable range is [-2^m, 2^m - 2^-n].

Common fixed-point formats in practice

Some formats appear repeatedly in DSP and embedded work:

FormatInteger bits (m)Fractional bits (n)Total bitsTypical use
Q1.1511517Audio DSP on 16-bit DSPs; range -1.0 to ~1.0
Q0.3103132High-precision fractional values; FIR filter coefficients
Q15.16151632General-purpose 32-bit fixed-point; game physics
Q8.88817Pixel blending, simple embedded sensor values
Q1.1411416Some ARM CMSIS-DSP filter coefficients

The notation Qn (without m) is sometimes used to mean Q0.n (all fractional bits, no integer part), and is common in audio contexts where values are normalised to the range -1.0 to +1.0.

Worked example: Q7.8

Encoding 3.14159 in Q7.8 (16 bits total, where m=7 and n=8):

scaled   = 3.14159 × 2^8 = 3.14159 × 256 = 804.247
stored   = round(804.247) = 804
decoded  = 804 / 256 = 3.140625
error    = 3.14159 - 3.140625 = -0.000965
hex      = 0x0324
binary   = 0000 0011 0010 0100

The range of Q7.8 is [-128.0, +127.99609375], so this value fits without overflow. The resolution (smallest step) is 1/256 ≈ 0.00390625.

Worked example: overflow

Trying to encode 200.0 in Q7.8 where the maximum is approximately 127.996:

scaled   = 200 × 256 = 51200
max Q7.8 = 2^7 - 2^-8 = 128 - 0.00390625 ≈ 127.996
OVERFLOW — value exceeds representable range

A saturating implementation would clamp to the maximum representable value. The converter flags this condition so you know to widen the format (add more integer bits) or scale your input values.

Choosing m and n

The trade-off is straightforward: more fractional bits (larger n) give finer resolution but a smaller integer range for the same total bit width. More integer bits (larger m) give a wider range but coarser resolution.

For a given word width (say 16 bits), you have 15 bits to split between m and n. A common approach:

  1. Find the largest value you need to represent. Set m so that 2^m comfortably exceeds it.
  2. Assign all remaining bits to n for precision.
  3. Check the resulting resolution (2^-n) against your accuracy requirements.

If your value exceeds the representable range the tool flags an overflow and clamps the result, mirroring what a saturating fixed-point unit would do. All computation runs locally in your browser.