Skip to content

Q-Format Fixed-Point Converter

Convert Q7, Q15, Q31, Q1.15, and Q16.16 values between decimal, raw integer, hex, and binary. Inspect exact stored values, quantization error, rounding, and overflow locally.

No Tracking Runs in Browser Free
All calculations run locally in your browser. Entered values never leave this device.
Q-format preset

Decode register words or a hex dump

Paste up to 256 hexadecimal words separated by spaces, commas, or newlines. Each token is decoded independently; byte order is not changed.

TokenHex wordUnsigned raw codeSigned stored integerExact stored value
Reviewed for Q-format semantics, rounding, overflow, and two's-complement boundaries — Go Tools Engineering Team · Aug 12, 2026

Our engineering team verifies fixed-point vectors with exact BigInt rational arithmetic and explicit boundary tests.

What is Q-format fixed point?

Q-format stores a real value as an integer plus an implied binary scale. For a word with F fractional bits, stored integer N represents N / 2^F; the point is not physically stored in the word. A signed word normally uses W-bit two's complement, while an unsigned word uses the full code range. This makes multiplication, filtering, and register storage predictable on hardware without floating-point support, but it also makes range, rounding, saturation, and notation part of the data contract. Q labels are not completely standardized, so this converter treats signedness, total width W, and fractional bits F as the canonical definition and displays them beside every result.

Converter features

Four synchronized representations

Encode or decode decimal, stored integer, hexadecimal word, and binary word from one authoritative input without passing through JavaScript Number.

Exact stored value and error

BigInt rational arithmetic prints the terminating decimal represented by the word and the signed quantization error from the original decimal input.

Explicit rounding and overflow

Compare nearest-even, truncation, and floor together with error, saturation, and two's-complement wrapping instead of assuming a hidden policy.

Common presets plus custom width

Start with Q7, Q15/Q1.15, Q31/Q1.31, or Q16.16, then define signed or unsigned formats from 1 to 64 total bits.

Bounded register-word decoder

Paste up to 256 hexadecimal words and decode valid rows independently while malformed or too-wide tokens remain visible as row-level errors.

Q-format conversion examples

Encode decimal 0.1 as signed Q15

Q15, decimal 0.1, round to nearest ties to even
raw integer 3277; hex 0x0CCD; exact value 0.100006103515625

Q15 scales by 2^15 = 32768. The ideal scaled integer is 3276.8, so nearest-even rounding stores 3277. Dividing that integer by 32768 gives the exact stored value; the quantization error is +0.000006103515625.

Decode the Q15 register word 0xC000

Q15 hex C000
raw code 49152; signed integer -16384; exact value -0.5

The 16-bit word has its sign bit set. Two's-complement interpretation turns raw code 49152 into -16384, and the Q15 scale converts -16384 / 32768 to exactly -0.5.

Encode 1.5 as Q16.16

Q16.16 decimal 1.5
raw integer 98304; hex 0x00018000; exact value 1.5

Q16.16 uses a 32-bit signed word and 16 fractional bits. Since 1.5 × 65536 is exactly 98304, no rounding is required and the quantization error is zero.

Compare Q15 overflow policies at 1.0

Q15 decimal 1.0
error rejects it; saturate stores 0x7FFF; wrap stores 0x8000

Signed Q15 ranges from -1 to 0.999969482421875, so 1.0 is outside the range. Saturation clamps to the largest word while wrap reduces modulo 2^16 and produces the most negative word.

How to use the Q-format converter

  1. 1

    Define the Q-format

    Choose a common preset or Custom, then confirm signedness, total word width W, fractional bits F, and the displayed scale 2^F.

  2. 2

    Choose the source representation

    Select Decimal value to encode a real number, or Raw integer, Hex word, or Binary word to decode an existing stored representation.

  3. 3

    Set conversion policies

    For decimal input, choose a rounding rule and decide whether an out-of-range result should error, saturate, or wrap.

  4. 4

    Inspect the stored result

    Compare the stored integer and raw code with normalized hex and binary, then check exact stored value, quantization error, range, and resolution.

Q-format conversion use cases

Decode DSP and MCU registers
Turn signed sensor samples, coefficients, and control-loop words from a register view into exact engineering values.
Prepare firmware test vectors
Encode decimal boundary values with the same rounding and overflow policy expected by firmware, then copy normalized raw words into tests.
Audit quantization error
Compare the requested decimal value with the exact grid point that a fixed binary scale can store before choosing a word width.
Read protocol hex dumps
Decode multiple same-width words without silently changing byte order; reverse bytes first when the protocol stores a different endianness.

Q-format representation details

Canonical definition
The converter defines a format by signedness, total bits W, and fractional bits F. The scale is 2^F and the resolution is 2^-F. Signed formats require F ≤ W-1; unsigned formats allow F ≤ W.
Signed and unsigned ranges
A signed W-bit word stores integers from -2^(W-1) through 2^(W-1)-1; an unsigned word stores 0 through 2^W-1. Divide both endpoints by 2^F to obtain the value range.
Two's-complement words
Hex and binary are always shown as unsigned W-bit raw codes. For signed formats, a code with its top bit set maps to stored integer rawCode - 2^W before scaling.
Exact decimal parsing
Decimal input uses an ASCII engineering grammar with optional sign, decimal point, and exponent. It is converted to a BigInt fraction before applying the binary scale, so no intermediate floating-point rounding changes the answer.
Input boundaries
Single inputs are limited to 256 characters, 128 significant digits, and exponent magnitude 1000. Batch input is limited to 16 KiB and 256 tokens to keep browser work bounded.

Fixed-point conversion best practices

Write W and F beside every Q label
Because Qm.n conventions vary, document signedness, total bits, and fraction bits at protocol boundaries instead of assuming everyone counts the sign bit the same way.
Match the target's rounding rule
A test vector is only useful when the converter and implementation use the same midpoint and negative-value rule; truncation and floor are different for negative fractions.
Treat overflow as an explicit contract
Saturation is common in DSP, while native integer arithmetic may wrap and validation layers may reject. Select the actual target behavior instead of relying on a language default.
Confirm byte order separately
Q-format defines numeric scaling, not byte order. This tool decodes each pasted token as written and does not reorder bytes from a memory or wire dump.

Q-format converter FAQ

What does Q15 mean?
In the common DSP convention used by this tool, Q15 is a signed 16-bit two's-complement word with 15 fractional bits: one sign/integer position and 15 fraction positions. Its scale is 2^15, resolution is 1/32768, and range is -1 through 32767/32768. Some documents use Qm.n differently, so verify the total width and signedness instead of relying on the label alone.
Are Q15 and Q1.15 the same?
They often refer to the same signed 16-bit layout, but Q notation is not universal. Some authors count the sign bit inside the integer count and others do not. This converter resolves the ambiguity by always showing signedness, total bits W, fractional bits F, and scale 2^F; its Q15 and Q1.15 preset is signed W=16, F=15.
How is a negative hexadecimal Q-format word decoded?
First parse the hexadecimal text as an unsigned W-bit raw code. If the format is signed and the top bit is set, subtract 2^W to obtain the two's-complement stored integer. Then divide that integer by 2^F. For signed Q15, 0xC000 becomes 49152 - 65536 = -16384, then -16384 / 32768 = -0.5.
Which rounding and overflow modes are supported?
Decimal encoding supports round to nearest with ties to even, truncate toward zero, and floor toward negative infinity. If the rounded integer is outside the W-bit range, Error rejects it, Saturate clamps to the nearest endpoint, and Wrap applies modulo 2^W. Raw hex and binary decoding does not round because the stored word is already exact.
When should I use Q-format instead of IEEE 754?
Use Q-format when a protocol, DSP algorithm, register, or embedded system defines a fixed binary scale for an integer word. Use IEEE 754 floating-point when the word contains a sign, dynamic exponent, and significand. For plain integer radix changes without a scale or signed width, use the number base converter.
Does this converter upload my values or hex dump?
No. Parsing, BigInt arithmetic, rounding, overflow handling, and batch decoding run locally in your browser. The batch input is bounded to 16 KiB and 256 words for responsive use, and entered numeric values are not included in analytics events.

Related Tools

View all tools →